There are 5 steps you need to know in the Nitrogen Cycle.....
Nitrogen gas is converted to nitrate compounds by nitrogen-fixing bacteria in soil or root nodules.
Lightning also converts nitrogen gas to nitrate compounds.
The Haber process converts nitrogen gas into ammonia used in fertilizers. Ammonia is converted to nitrates by nitrifying bacteria in the soil.
Plants absorb nitrates from the soil and use these to build up proteins. The plant may be eaten by an animal, and its biomass used to produce animal protein.
Urea and egested material is broken down by decomposers. This results in nitrogen being returned to the soil as ammonia.
Decomposers also break down the bodies of dead organisms resulting in nitrogen being returned to the soil as ammonia.
In some conditions denitrifying bacteria in the soil break down nitrates and return nitrogen to the air. This is usually in waterlogged soil. Improving drainage reduces this effect, making the soil more fertile.