The first step in making nitrogen is making ammonia, which is produced by taking nitrogen from the atmosphere and combining it with hydrogen from methane, which is the largest component of natural gas. The end result is NH3, or anhydrous ammonia.

The chemical reaction that creates that NH3 needs energy, in the form of heat, which is created by burning a lot more natural gas.

And of course, NH3 is the base of all other nitrogen fertilizers.