The flow of energy in ecosystems is vitally important to the thriving of life on Earth. Nearly all of the energy in Earth's ecosystems originates within the Sun. Once this solar energy reaches Earth, it is distributed among ecosystems in an extremely complex manner. A simple way to analyze this distribution is through a food chain or food web. As the US DOE says, " Biological processes depend on energy flow through the Earth system."
All organisms, dead or alive, have potential for energy transfer in an ecosystem. For example, a leaf is eaten by a caterpillar, which is eaten by a small bird, which is eaten by a hawk. If the leaf was left uneaten, it would fall to the ground and be decomposed by smaller organisms. Therefore little matter is actually wasted in ecosystems.
However, energy is a different story. Due to the second law of thermodynamics, not all energy can be made full use of. Throughout the food chain the energy must be converted into useful work, which always yields wasted energy as heat. See below, and visit the page on Entropy for more information.
A food chain catalogs the movement of this energy and nutrients from one organism to another.
There are varying levels in a food chain, known as trophic levels, all starting at the producers which originally absorb the sun's light. It then moves up to the organisms that eat or decompose it, which continues all the way to the apex predators (those that are no longer typically eaten by other animals) which can only decompose at a later point.
Each level contains a certain amount of biomass, which is transferred from one level to the next. This transfer is not very efficient however, and this is due to the second law of thermodynamics, as mentioned above. Only a portion of what is consumed is actually converted into usable biomass from level to level, with typical efficiencies of 2-40%. This is known as ecological efficiency.
The more levels in the food chain, the more energy is lost as it gets to the top. Assuming a 10% efficiency, if there were 10 000 units of energy initially from the sun and 4 levels to the apex predator, each level would receive 10x less energy until the apex predator received just 1 unit of this energy. This example helps explain why there are countless decomposers and insects, while there is a visibly small amount of tigers, sharks, and eagles in the world. It also explains why these top species are the first to experience extinction when their ecosystems are altered.
The video below from the US DOE