In 1904, Danish scientist Christian Bohr noticed that hemoglobin binds oxygen more tightly at high pH than it does at low pH. The Bohr effect explains oxygen release in capillaries, why red blood cells unload oxygen in tissues. Bohr stated that at lower pH (more acidic environment, e.g., in tissues), hemoglobin will bind to oxygen with less affinity. The Bohr effect has to do with hemoglobin's ability to pick up or donate hydrogen ions. As pH rises, hemoglobin loses hydrogen ions from specific amino acids at key sites in its structure, and this causes a subtle change in its structure that enhances its ability to bind oxygen.
When pH falls in the blood, when it becomes slightly more acidic, the reverse happens: hemoglobin picks up hydrogen ions and its affinity for oxygen decreases. The pH of your blood is very tightly buffered thanks to the bicarbonate it contains and to hemoglobin, which can pick up or lose hydrogen ions to counteract changes in pH. Hemoglobin affinity for oxygen is how readily hemoglobin acquires and releases oxygen molecules into the fluid that surrounds it.
Hemoglobin will drop off more oxygen as the concentration of carbon dioxide increases dramatically, like when we exercise, when tissue respiration is happening rapidly, and oxygen is in greater need. The opposite is true under low CO2 levels, hemoglobin will drop off less oxygen.
Increasing CO2 concentration drives a decrease in pH, which helps force hemoglobin to dump the oxygen it's carried from the lungs, so your cells can use it to break down sugars for energy.
Decreasing CO2, through faster than normal breathing when at rest, has the opposite affect of putting the breaks on oxygen delivery. The pH-mediated change in affinity for oxygen helps hemoglobin act like a shuttle that picks up oxygen in the lungs and deposits it in the tissues where it will be needed.
The dissociation of oxygen is also helped by magnesium because it provides an oxygen adsorption isotherm which is hyperbolic. It also ensures that the oxygen dissociation curves are sigmoidal which maximizes oxygen saturation with the gaseous pressure of oxygen (Murray et al pp. 65-67).
Oxygen dissociation with increased delivery to the tissues is increased by magnesium through elevation of 2,3-bisphosphoglycerate/DPG (Darley, 1979) Magnesium stabilizes the ability of the phorphyrin ring to fluoresce. Free-radical attack of haemoglobin yields ferryl haemoglobin [HbFe4+] (D’Agnillo and Alayash, 2001), which is inhibited by magnesium (Rock et al, 1995).