Facultative Cannibalism?
Lions

Lions are a classic example of cannibalism. To understand why this occurs we have to understand their mating system.

Males have a harem of females and males fight in order to access a harem (Note: females may also take part in the battle depending on which male they prefer). When a male takes over a new harem, he kills the young ones of the previous male if these young ones are still dependent on their mother. The reasons are:


The mother is not fertile while she is taking care of a young baby while the male would appreciate that the female is ready to raise his own kids.
The mother needs to invest quite a lot of energy to feed/milk their young while the new male would prefer this energy to be invested in his own offspring.


In short, a male kills the young ones when he takes over a new harem because these young ones do not carry his genes and prevent this new male to optimally pass on his own genes as the offsprings of the previous male consume time and energy from the females of the harem.

And well… once the offsprings are killed, it would be a shame to waste all this good and fresh meat. Better to eat them!

In the cases of lions, cannibalism does not result from food shortage but from "not wasting food". I think that the "not wasting food" hypothesis is the most explanation for cannibalism (I am not sure though). I guess that most often the "not wasting food" occurs after death due to competition as it is the case in lions.

Other Examples

There are many cases of cannibalism in the animal kingdom. Chimpanzees eating other chimpanzees and bear eating other bears. In the tiger salamander, there are cannibal morph and normal morphs. In this species cannibalism is very frequent as in nature one offspring over 5 is eaten through cannibalism (if I am not mistaken). Cannibalism is very common in prairie dogs as well (Reference). In Dragonflies cannibalism represents 95% of the total mortality (Reference).

Sibling sharks eat each other in their mum's womb. Here is a video on the subject. This type of cannibalism is called siblicide.

In Praying mantis the female may eat her mate after copulation. This is referred to as sexual cannibalism. The subject is slightly controversial, please have a look to the wiki article for more info.

In many species (including the dragonflies example above) the old individuals eat the young. This is referred to size-structured cannibalism.

Fillial cannibalism is a type of cannibalism when the adults eat their own offsprings as it is the case in the prairie dogs example I cited above.

Have a look to the Wikipedia links for filial cannibalism, sexual cannibalism and siblicide, they go further than my answer.