Microorganisms participate in all parts of the biogeochemical cycle. For example, when it comes to nitrogen, they fix N2 from the air, and contribute in various ways to oxidize and reduce nitrogen compounds, until they end up as free N2 again. It is the same with other elements. Microorganisms bind and release. They often live in communities, where one person's waste becomes food for others. To describe this requires books. A short answer is not enough. Much can be found in biology textbooks. The most basic cycles are described there.