In most food chains, all of the energy which is used originally comes from the sun. Plants are "photoautotrophs", which means that they can use light energy from the sun to fuel their life processes. They therefore form the first stage, or "trophic level", of most food chains and are called "producers". At each trophic level after this "consumer" species eat the species from the level below them. In this way, energy, which is stored in living material, or "biomass", moves up the chain. Primary consumers eat producers, secondary consumers eat primary consumers and so on. Consumers are "heterotrophs", meaning that they need to feed on other organisms in order to survive.
As you move up trophic levels, much of the energy in a food chain is lost, as only a small proportion of it is used for growth. The rest is used for other life processes or lost as waste. This is why food chains are usually quite short, as energy is rapidly lost from the system as you move up trophic levels, and also means that species at higher trophic levels tend to have smaller populations. However, there are exceptions to this rule, so looking at population sizes isn't always the best way to examine energy transfer from one trophic level to the next. Pyramids of biomass are a better way to visualise this energy loss. They show the overall biomass of species at each trophic level, which will always decrease the further up a food chain you go.