These pigments are betalain pigments (not, as often thought, anthocyanins), which they replace in some organisms.
They are named after the Beet family of plants (Beta) but are also found in fungi (Fly Agaric - the red, spotted one!). In petals they presumably attract pollinating insects and may be present in seeds/fruits to encourage birds to eat them and so disperse the seeds.
Man has selected for colour in beetroot, both because it is more attractive but also because it may well be linked to genes for flavour too. There is no indication that they have any protective function (e.g. against UV light or insect/fungal/viral attack). Unlike anthocyanins, they are not pH indicators – their colour is stable over a wide range of pH. They are oxidised over time (going brown) and this may be prevented by 0.1% ascorbic acid ( = Vit.C); they are sometimes used as food colourants.
They are found in the vacuole and thus are used as markers for scientists who wish to extract intact vacuoles from plants for research. To extract the pigment, the membranes must be disrupted. This can be done by heat shock, by detergents or by solvents (e.g. ethanol or acidified methanol). Thin slices have a larger surface area and so leak more pigment; freezing the beetroot first bursts the cell membranes and kills the cells, thus allowing the pigment to be extracted much more quickly.
Effect of Heat:
When you heat a beetroot, you disrupt the cell membranes. A biological membrane is made of a so-called phospholipid bilayer. These are formed because the phospholipids that make it up have a polar "water-loving" (hydrophyllic) head and a “water-hating” (hydrophobic) tail. The tails pack together, exposing only the polar heads to the water. The most effective way of doing this is to create two blankets one atop the other, with the fatty acid tails towards each other. This is the phospholipid