Placing an element into a flame promotes some of its outermost electrons into an even higher-energy level or orbital. Then, specific wavelengths of light are produced by excited electrons as they transition back into their most stable position, releasing very specific amounts of energy in the process.