The Food Web
Decomposers break down dead organisms and other organic matter. Thus they process energy from all levels of the food web, from primary producers like plants and lichens to apex predators. An African lion or grizzly bear may be fearsome and free of predators, but ultimately such beasts are consumed by the bacteria, fungi and other decomposers. Decomposers also feed on waste products such as shed skin cells and fallen leaves. In performing this service, decomposers liberate nutrients from immobilization -- their state when taken up in the tissues of plants and animals -- and mineralize them back into inorganic form, ready for use again by living systems.
Decomposers do indeed return nutrients to the soil -- and to the atmosphere. They extract carbon from their food that, combined with oxygen, creates carbon dioxide. This might transfer to the atmosphere to be utilized again by photosynthesizing plants. Or it may incorporate with groundwater and leaching rainwater to form carbonic acid, a major force of chemical weathering; the substance is greatly responsible for the excavation of limestone and dolomite into caves, caverns, sinkholes and other karst landforms. Also released in decomposition are nutrient compounds of nitrogen and sulfur. Of the former, ammonium, nitrites and nitrates are immensely important for plant growth. Nitrifying bacteria supply such compounds to the soil; denitrifying bacteria transform nitrogen into its gaseous form to be released into the atmosphere.
Bacteria and fungi are some of the major decomposers in soil environments. Various kinds specialize in different parts of the decomposition process. Some fungi and bacteria set to work immediately upon, or even slightly before, the death of an organism, processing easily broken-down substances like sugars and amino acids.
Animal processors of organic materials in the soil are sometimes called detritivores, and are among the participants in the decomposition process. Some of the most prominent of these are the earthworms, members of the so-called soil "macrofauna" -- larger than microfauna like nematodes, smaller than megafauna like ground squirrels. Some species of these worms consume decaying leaf litter and organic particles, excreting nutrient-rich waste matter called castings that substantially elevate levels of humus, potash, phosphorus and nitrogen in the soil.