Why is the maximum size of an energy pyramid 5 levels?
The amount of energy available as one moves up the energy pyramid decreases substantially.
At each trophic level, energy is lost primarily through heat loss and respiration.
In the image below, 100% of the energy from the plant is not available to the deer. As we move further from the primary producer (in the image below, the green plant), less and less energy is transferred.
Consequently the predator (animal at the top floor the pyramid) only receives very little energy from the primary producer. Subsequently, it is a lot harder for animals higher up the pyramid to gain the nutrients they need.
Any animal above the 5th level will be using more energy than its gaining by eating the animal- that is why most pyramids do not have trophic levels above 5. In the image above, the deer expends minimal energy consuming the grass and consumes 10J. In comparison, the lion would have to expend significant energy to consume the 1J of energy available from the deer (note that male lions do not typically expend any energy hunting and they don't hunt the type of deer in the image).