Introducing Energy States
Around an atom, there are 7 different electron shells1. When the electrons receive the necessary amount of energy, they jump from one state to another (called "ground state" and "excited state"), as shown in the image below:
The figure (generated by POV-Ray) shows excitations of copper 3d orbitals on the CuO2-plane of a high Tc superconductor; The ground state (blue) is x2-y2 orbitals; the excited orbitals are in green; the arrows illustrate inelastic x-ray spectroscopy;
When a molecule absorbs light in the UV-vis (Ultra-Violet-Visible) region ranging from 400nm to 780nm wavelength, an electron is promoted from a lower- energy occupied orbital to a higher-energy empty orbital resulting in an excited state molecule. One requirement for a molecule to absorb light is that the energy of the photon needs to match the energy difference between the orbitals.
Photons having insufficient energy will be transmitted. Therefore, the colours of light absorbed proved us with experimental information about the energy spacing between orbitals.
Source: Scott Cummings, 2008; The Chemistry of Excited States
Newton first had ideas regarding spectroscopy, and later on, William Wollaston and Joseph von Fraunhofer built the first spectrometers and discovered the spectral signatures.
As different elements have different spacing between electron orbitals, the energy needed to absorb or emit photons is different and therefore2 photons of different wavelengths are absorbed or emitted. This results in a specific spectral signatures of a molecule, a set of spectral lines.
Spectroscopy is really important for astronomers because it can tell them about the molecular make-up of planets, stars and nebulae.
Further Reading: Fraknoi, Andrew; Morrison, David (13 October 2016). "OpenStax Astronomy"
Introducing Hemoglobin and Oxyhemoglobin
Red blood cells contain haemoglobin, an iron-containing protein (thus oxygenated hemoglobins are red), which facilitates oxygen transport by reversibly binding to this respiratory gas and greatly increasing its solubility in blood. The oxygenated hemoglobin is called oxyhemoglobin.
Left: Molecular Graphic of a Human Oxyhemoglobin (HHO), two of the four oxygen module this fully saturated haemoglobin currently carries are circled blue by me (the red "stick" represents the oxygen molecule in this graphic).
Right: The same molecule in the same resolution, this time with a highlighted solvent accessible surface.
Putting it all together
Luckily for modern medicine, the absorption of light at wavelengths of 660nm and 940nm differs significantly between haemoglobin loaded with oxygen (oxyhaemoglobin) and haemoglobin lacking oxygen.
The isobestic point is the point at which two substances absorb a certain wavelength of light to the same extent. In oximetry, the isobestic points of oxyhaemoglobin (HbO) and deoxyhaemoglobin (Hb) occur at 590 nm and 805 nm. These points may be used as reference points where light absorption is independent of the degree of saturation. Some earlier oximeters corrected for haemoglobin concentration using the wavelength at the isobestic points.
Thus comparison of absorbencies at different wavelengths allows estimation of the relative concentrations of HbO (oxyhaemoglobin) and Hb (haemoglobin) (i.e. saturation). Modern pulse oximeters may use two or more wavelengths, not necessarily including an isobestic point.
Basically, this is how pulse oximetry works. It can tell saturated and unsaturated haemoglobin apart, using different absorption of light due to different electron configurations in the molecules. Below is an extract about the technical aspects of pulse oximetry:
There are two methods of sending light through the measuring site:
transmission and reflectance. In the transmission method, as shown in
the figure on the previous page, the emitter and photodetector are
opposite of each other with the measuring site in-between. The light
can then pass through the site. In the reflectance method, the emitter
and photodetector are next to each other on top the measuring site.
The light bounces from the emitter to the detector across the site.
The transmission method is the most common type used and for this
discussion the transmission method will be implied.
After the transmitted red (R) and infrared (IR) signals pass through
the measuring site and are received at the photodetector, the R/IR
ratio is calculated. The R/IR is compared to a "look-up" table (made
up of empirical formulas) that convert the ratio to an SpO2 value.
Most manufacturers have their own look-up tables based on calibration
curves derived from healthy subjects at various SpO2 (Peripheral Oxygen Saturation) levels. Typically
a R/IR ratio of 0.5 equates to approximately 100% SpO2, a ratio of 1.0
to approximately 82% SpO2, while a ratio of 2.0 equates to 0% SpO2.
The Dangers of Carbon Monoxide Poisoning
The spectral signature of carboxyhemoglobin (hemoglobin saturated with CO) is so similar to that of oxyhemoglobin that standard oximeters mistake one for the other, as multiple studies have shown:
This report confirms that pulse oximetry may be misleading during carbon monoxide poisoning as the pulse oximeter does not differentiate between HbO (oxyhemoglobin)and HbCO (carboxyhemoglobin). Diagnosis of carbon monoxide poisoning therefore relies on clinical evidence and must be confirmed by measuring the HbCO concentration with a multiple band CO-oximeter (Carboxy-oximeter).
Carboxyhemoglobinaemia and pulse oximetry, British Journal of Anaesthesia, 1991
Nowadays, CO-oximeters exist that can differentiate between oxyhemoglobin, carboxyhemoglobin and methemoglobin.
1: An explanation as to why this is the case would lead way too far. It has to do with the wave-particle dualism of quantum mechanics and a good analogy can be found in this answer on Physics.SE.
2: The energy of a photon is proportional to its frequency and and thus inverse proportional to the wavelength. All other factors in the Planck-Einstein equation are constant. More information can be found on Physics.SE