Decomposers are the organisms which, for example, make leaves and dead bodies decompose. What do these contain? They contain mainly carbon, oxygen and hydrogen, together with proteins (which contain nitrogen) and other substances such as calcium, phosphorous, magnesium, sodium, potassium, etc (minerals).
Minerals get into the soil, while proteins are converted to ammonia by decomposers then to nitrites then nitrates by nitrogenous bacteria (not decomposers). The decomposers basically feed on the dead matter and respire in doing so. Hence you get carbon dioxide and water.
Also, denitrifying bacteria lastly converts excess nitrates to nitrogen gas.