Nitrogen combines with other molecules in the body to produce toxic compounds such as ammonia
And so the animal must find a way to excrete these toxins. As we already know, this is the function of the kidneys and the rest of the renal system.
Terrestrial animals, however, because they have less access to water, have been under selective pressure to
Mammals metabolize ammonia into a molecule called urea:
As you can see, this molecule contains two atoms of nitrogen. Although it requires metabolic energy to build, it also is less toxic than ammonia, and it requires less water to flush from the system. Your urine's main nitrogenous waste product is urea.
...which contains FOUR nitrogen atoms per molecule. It requires more metabolic energy to make than urea, but it also eliminates more nitrogen per molecule and, is quite non-toxic, and requires very little water to flush from the body.
The white, crystalline substance you see in a typical bird or lizard "poop" is actually urine: a little pool of uric acid crystals in a very small amount of water.
So there are three general ways that vertebrates rid their bodies of nitrogenous waste: