How is the flame test useful analytical tool?
The arrangement of electrons around an atom, ion, or molecule are unique to the particular elements involved. When the substance is heated sufficiently the electrons in the orbits will become excited and move to higher energy levels. As the electrons relax to their rest state the release energy in the form of electromagnetic waves which are also unique to the elements that make up the ions, atoms, or molecules.
In the flame test experiment, one heats the ions until the substance glows. The glowing is due to electrons moving back to their rest state. By observing the wavelengths of the emitted light, the observer can compare the collection of wavelengths to those of known materials. This allows for the determination of the ions based on the colors of their emission spectra.