When elemental magnesium burns in air, it combines with oxygen to form an ionic compound called magnesium oxide or MgO. The magnesium can also combine with nitrogen to form magnesium nitride, Mg3N2, and can react with carbon dioxide as well. The reaction is vigorous and the resulting flame is a brilliant white in colour. At one point, burning magnesium was used to generate light in photography flashbulbs, although today electric flashbulbs have taken its place. It remains a popular classroom demonstration nonetheless.
Remind your audience that air is a mixture of gases; nitrogen and oxygen are the principal constituents, although carbon dioxide and some other gases are present as well.
Explain that atoms tend to be more stable when their outermost shell is full, i.e. contains its maximum number of electrons. Magnesium has only two electrons in its outermost shell, so it tends to give these away; the positively charged ion formed by this process, the Mg+2 ion, has a full outer shell. Oxygen, by contrast, tends to gain two electrons, which fills its outermost shell.
Point out that once oxygen has gained two electrons from the magnesium, it has more electrons than protons, so it has a net negative charge. The magnesium atom, by contrast, has lost two electrons, so it now has more protons than electrons and hence a net positive charge. These positively and negatively charged ions are attracted to each other, so they come together to form a lattice-type structure.
Explain that when magnesium and oxygen are combined, the product, magnesium oxide, has lower energy than the reactants. The energy lost is emitted as heat and light, which explains the brilliant white flame that you see. The amount of heat is so great that the magnesium can react with nitrogen and carbon dioxide as well, which are both usually very unreactive.
Teach your audience that you can figure out how much energy is released by this process by breaking it into several steps. Heat and energy are measured in units called joules, where a kilojoule is one thousand joules. Vaporising magnesium to the gas phase takes about 148 kJ / mole, where a mole is 6.022 x 10^23 atoms or particles; since the reaction involves two atoms of magnesium for every O2 oxygen molecule, multiply this figure by 2 to get 296 kJ expended. Ionising the magnesium takes an additional 4374 kJ, while breaking the O2 up into individual atoms takes 448 kJ. Adding the electrons to the oxygen takes 1404 kJ. Adding up all of these numbers gives you 6522 kJ expended. All of this is recovered, however, by the energy released when the magnesium and oxygen ions combine into the lattice structure: 3850 kJ per mole or 7700 kJ for the two moles of MgO produced by the reaction. The net result is that the formation of magnesium oxide releases 1206 kJ for two moles of product formed or 603 kJ per mole.
This calculation doesn't tell you what's actually happening, of course; the actual mechanism of the reaction involves collisions between atoms. But it does help you to understand where the energy released by this process comes from. The transfer of electrons from magnesium to oxygen, followed by the formation of ionic bonds between the two ions, releases a large amount of energy. The reaction does involve some steps that require energy, of course, which is why you need to supply heat or a spark from a lighter to kickstart it. Once you've done so, it releases so much heat that the reaction continues without any further intervention.
If you are planning a classroom demonstration, please remember that burning magnesium is potentially dangerous; this is a high-heat reaction, and using a carbon dioxide or water fire extinguisher on a magnesium fire will actually make it much worse.