The atmosphere, and how it became livable
Our atmosphere consists mostly of nitrogen and oxygen. (They are about 78% and 21% of it by volume.) Nitrogen is a building block of all life forms. Free oxygen was poisonous to early forms of life but is essential to animal life we breathe it.
x The next most abundant constituent is water vapor. Then argon (an inert element which essentially does nothing; its Greek name means no work). Then carbon dioxide. Then various other elements (such as neon and helium) and compounds (mainly methane, nitrous oxide, carbon monoxide, ozone); also dust, sea spray, bacteria, spores, pollen, and man-made pollutants.
The smaller constituents are usually measured by volume in parts per million; one ppm is 0.0001%. Carbon dioxide is now about 390 ppm. A millionth of the atmosphere may sound like a small quantity; but the atmosphere covers the 200 million square miles of the earth's surface to a depth of fifty miles or so.
In the far past the atmosphere was very different. It had no oxygen gas, but abundant carbon dioxide. From somewhere around 2,500,000,000 years ago, cyanobacteria began a slow and massive transformation, which algae and plants continue.
x They take in water and carbon dioxide, and use the energy of sunlight to reshuffle these into carbohydrate and excess oxygen. They expel the excess oxygen as a waste product, and build themselves with the carbohydrate, which thus not only stores the carbon but becomes the basic foodstuff of almost all other living things. (And, through the day of plants, the source of all fossil fuel.)
This is the magnificent recipe called photosynthesis, putting together with light. It created the new oxygen-rich atmosphere in which animals can live. Plants take carbon dioxide from the air and put oxygen into it, animals breathe oxygen from the air and exhale carbon dioxide into it.
(Scientists do not yet fully understand how natural photosynthesis works how it uses some other substances as catalysts.)
There are some other processes:
Carbon dioxide is also removed from the air into sediments and into the ocean. Carbon dioxide is put back into the air not only by animals but by plants as they decompose, by fire, by volcanoes, and by the weathering of rocks. And by human farming and industry. There is, or was, a steady state: the rate at which carbon dioxide escaped into the air was balanced by the processes that capture it back.