Pretty simple process.
Ammonia waste is released into the water and the ammonia levels rise
Nitrosomas bacteria eat ammonia and their population will rise and the ammonia levels will drop
A by product of the above it Nitrite and those levels will rise over time
Nitrobacter bacteria eat nitrite and their population will rise and the nitrite will drop
A by product of this second step is Nitrate
Nitrate is the least toxic of the three and the concentration will rise over time.
Just because it is less toxic does not mean Nitrate levels should be allowed to rise above a few ppm at most. Consistently high levels are indicitive of overfeeding, underfiltration, or generally poor husbandry and will lead to stressed animals.
Nitrate is removed by the metabolic action of plants, water changes, and special bacteria that are generally not found in any concentration in normal fishtanks as they are anaerobic and require either a very slow flow chamber, a very deep substrate, or a plenum set-up.