Decomposers break down dead animals, urea and egested materials which releases nitrogen into the soil as ammonia.
Nitrifying bacteria convert nitrates into nitrogen.
Denitrifying bacteria break down nitrates into nitrogen which is then released into the atmosphere.
Here is a diagram to help explain:
This animation is very helpful: