In the beginning, a female butterfly deposits her eggs onto a specific plant. The female has odour detectors which allow her to locate the plant, sometimes from as far away as two or three kilometres. The trick to encouraging butterflies into your garden is to cultivate these plants. You can easily find out which ones are tasty for the caterpillars in your area by ringing a reputable plant nursery.
Caterpillars are fussy eaters, and usually a species is limited to only one or two types of plants that the caterpillar will accept. If you were wondering why we don't see as many butterflies around as we used to, it's because the use of herbicides has reduced the availability of many of the weeds that caterpillars eat. No caterpillars, no butterflies!
Approximately four to five days after the fertilised egg has been laid, the caterpillar eats it's way out of the shell, often turning around and ingesting it. If the female laid on the correct plant, the caterpillar then goes on to eat it's first meal, and with a few exceptions, this meal is basically uninterrupted - these guys are the original eating machine. Being very small when it first emerged, the caterpillar soon becomes too big for its skin, and within a week, will attach it's hind parts onto a leaf by way of silk, rest for a while, and then literally walk out of it's skin. The new skin has enough stretch in it to allow further growth, and during it's time as a caterpillar, it will repeat this process another three times. Often the new skin differs slightly in pattern or colour to the previous one.
Each stage is called an "instar".When the caterpillar reaches the end of the 5th instar, a butterfly caterpillar will ready itself ,and letting go with all it's feet, hangs suspended from the "neck" and back feet. Some species are just secured by the hind parts and hang upside down. A day or two later, the head will dislodge and the skin will split open revealing the already complete pupa casing. The butterfly will form inside this case, and emerge some weeks/months/years later, again depending on what type of butterfly it is. Many butterflies use this period as a "hibernation" period.
When the butterfly finally emerges, it is a fully formed adult, with only the wings needing to be pumped up and dried. Then off it will fly, ready to play it's part in starting the whole cycle over again. And the reason for all this complexity? Two distinct advantages are that the adult form, eating nectar, rotting fruit or sometime sap, does not compete for food resources with the young. Being able to fly in the reproductive part of the cycle also means that the gene pool is greater than if restricted to a small area.