In way Nitrogen can be converted into a nitrate ion is by lightning. When lighting hits a nitrogen atom it reacts with oxygen. This then produces nitrates. A plant uses nitrates to create its deoxyribonucleic acid. They also convert nitrates into amino acids which are used to build protein. For the nitrates to reach a plant they have to dissolve into water. If an animal eats a plant the animal consumes the plant's amino acids. They use them to create protein.

image source
Bacteria can also convert nitrogen molecules to a nitrate ion. These bacteria are found near the roots. The bacterium helps a plant by using sugars which are given to it by a plant to create nitrogen. Usually these bacteria create more than enough usable nitrogen. The excess nitrogen goes into the soil and provides nitrogen to other plants.
Nitrogen is also produced from the waste of a living organism. Decomposers break these wastes down into substances. An example of this is ammonia. They then help organisms such as plants mentioned above.
As you can see Nitrogen can be transferred into the environment through many ways. The three mentioned were from lighting, bacteria, and from the waste of an organism. All plants and animals need nitrogen to live. Without it there would be no life on Earth.
Phil