Volcanic activity releases CO2, CH4, H2O and NH3. - The surface of the Earth cooled to the point where the water vapour could condense (temperature below 100°C) into liquid water, (resulting in rain as suspended water particles dropped) forming oceans.
2. CO2 dissolved into newly formed oceans and photosynthesising plants (algae and green plants) evolved in the oceans, removing CO2 and releasing oxygen.
3. Ammonia and methane reacted with the oxygen to form nitrogen gas and water (nitrogen built up overtime in atmosphere) - nitrogen also produced due to denitrifying bacteria (nitrates from decaying plants).
4. Carbon from CO2 is locked in sedimentary rocks as carbonates and fossil fuels - marine animals with shells evolved and used CO2 to form their shells, when animal dies, shell sinks to bottom of ocean forming carbonate rocks like chalk and limestone - prevented carbon being released.
Large number of marine animals and trees died and were buried under layers of rock and mud - over time these organisms decayed forming fossil fuels like crude oil and coal which locked up carbon.
5. Some of the oxygen is converted into ozone - a layer which blocks out harmful ultraviolet rays which allows for the development of new life on land.
Gases in air can be separated using fractional distillation - these gases can be separated from each other as they have different boiling points.
Nitrogen
Used as a cryogenic (very cold) liquid and providing unreactive atmospheres for food packing (slow down food spoilage) and certain reaction (prevent reactions with oxygen).
Oxygen
Used in medical treatment for respiratory issues and various industrial processes, like removal of carbon impurities from steel.
Argon
Used to provide an interactive atmosphere for certain chemical reactions (extraction of titanium using sodium) and in certain industrial processes (arc welding - lightbulbs, glow tubes.
Neon
Used as a cryogenic (very cold) liquid and for production of certain lasers and neon signs.
Radon
Cancer treatment, tumor treatment.
Helium
Balloons, artificial atmosphere (lighter than air).