The FID works by introducing a gas sample into a hydrogen flame. When the organic compounds in the sample combust, they produce ions and electrons. These ions are then collected by a pair of electrodes, generating a current. This current is measured and recorded, providing a quantitative analysis of the compounds in the sample. The detection is highly sensitive to hydrocarbons, making it an excellent choice for analyzing organic molecules.