IR detectors function by absorbing infrared radiation emitted or reflected by substances. This radiation induces molecular vibrations, which are characteristic of specific chemical bonds. The detector then converts these vibrations into an electrical signal, which is processed to produce a spectrum. This spectrum can be analyzed to identify and quantify the chemical species present.