How are bitter almonds detected or used? Bitter almonds contain traces of hydrocyanic acid, which can be lethal to animals and humans. 7 to 10 unprocessed bitter almonds can be lethal to a human, according to “Encyclopedia Brittanica.” 

The sale of raw bitter almonds is prohibited in some countries but it's quite often to find bitter almonds mixed with sweet ones.

My question is: How does food industry to detect the bitter ones?

If you just eat some almonds at home you are unlikely to swallow big quantities of poison because you would spit out the bitter ones.
But when the almonds are processed to make some raw preparation everything gets mixed and the presence of minimum quantities of bitter almonds would be perceptible, unpleasant and even dangerous. I guess they don't throw everything to the bin.

The toxicity of the poison is destroyed by heat and processing, usually by boiling or baking them. Thus my concern is about raw preparations.
How are bitter almonds detected? (*)
Or how is prussic acid removed without affecting the food?

How is their flavour used at Disaronno or Amaretto leaving out the poison?.  I have friends that drunk a whole bottle in one night and are still alive.

(*) of course without performing a chemical analysis to each almond nor using spectrography nor having somebody tasting every almond.

https://en.wikipedia.org/wiki/Amaretto
PD: Some spirits use apricot kernel instead, but the problem is the same.
I only have an answer for your first question: How does the food industry detect the bitter almonds? They don't need to.

According to Wikipedia, bitter almonds come from bitter almond trees, and "sweet" almonds from that variety, so if you plant only "sweet" almond trees in your orchard, you don't need to sort through your almonds rejecting the bitter ones.

This is from    https://en.wikipedia.org/wiki/Almond#Sweet_and_bitter_almonds
and matches my experience of seeing certain almond trees that remain loaded with almonds even as the squirrels are stripping all the other trees in the area. No wonder! Those almonds taste terrible; even the squirrels won't eat them.