You can make an educated guess as to the material burning based on the color and brightness. For example, copper adds a blue-green hue, sodium a distinct yellow-orange (the same as the color of sodium-arc street lights), and magnesium burns so brightly it is not safe to look at directly without protective eyewear.  However, to determine more exactly the composition of a burning material,  you need to look at its spectrum.  

A flame spectrophotometer is one such laboratory device that does this to a high degree of specificity, by burning the material in flame and measuring the spectrum of the light produced by the flame.  It can tell you all of the atomic elements present in a specimen, and their activation levels, which can give a clue to the molecular structure.  However, substances made of complex molecules may require more sophisticated techniques (such as a mass spectrometer), or constraints and assumptions on the materials being tested (for instance, if you only need to know whether wood is being burned, you don't need to identify every molecule present in all woods, you merely need enough information to rule it out or confirm it).  

You can perform a simpler form of flame spectroscopy at home, all you need is a diffraction grating.  In a dimly lit space, with a dark background behind the flame, burn the substance to be identified while looking at the flame through the diffraction grating.  You will see colored lines.  These are the spectrum lines of the atoms in the flame.  With practice, you can identify many different substances this way, like a fingerprint.  (Remember to take safety precautions whenever handling flame: have a fire extinguisher nearby, wear protective eyewear and clothing, and always have adult supervision if you are not one.  For safety, it's best to perform these experiments in a fire-safe space outdoors at night rather than a darkened room.  Do not burn anything dangerous or excessively bright, such as magnesium.)

A strip of diffraction grating, mounted in a slide or paper eyeglasses, is inexpensively available from any laboratory/classroom/scientific supplier, or from online retailers. You can also make it at home from common materials, such as a shard of a broken Compact Disc, by following online DIY tutorials.  Diffraction gratings are a fun way to identify burning substances, and can even identify non-burning substances that give off a lot of light, such as the materials inside various kinds of light bulbs.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence