Red blood cells contain a protein called hemoglobin that takes up and releases oxygen in response to the environment around it. Hemoglobin is what's called a "metalloprotein" because it incorporates atoms of iron into its structure. This iron is positively charged and readily binds with oxygen. In oxygen-poor environments, the hemoglobin releases the oxygen it carries and picks up carbon dioxide.
When hemoglobin is exposed to high oxygen concentrations, such as in the lungs, it flexes open to expose its iron atoms to the oxygen. After binding with oxygen, the hemoglobin is carried by red blood cells to various parts of the body. These destination sites are poor in oxygen, and the differential induces the hemoglobin protein to shed its oxygen. The ionized iron is then exposed and eager to bond with carbon dioxide. The hemoglobin holds this waste gas securely until the red blood cell is transported back into the oxygen-rich environment of the lungs, where the cycle repeats and more oxygen is taken up.
Around 25 percent of the cells in the human body are red blood cells, with 2.4 million of them produced every second. Each red blood cell contains around 270 million hemoglobin molecules, circulates through the body once every 20 seconds, and lasts between 100 and 120 days before breaking down.