How does electromagnetic radiation relate to flame tests?
When elements are burned each one releases a unique set of discrete frequencies of light (electromagnetic radiation) which combine to form a colour. The coloured light can be split into a line spectrum with a spectrometer.
video from: Noel Pauller
The results of flame tests were known for a long time before a satisfactory explanation for them was provided after the birth of quantum theory. If an element is burned it produces a unique line spectrum in the infrared, visible and ultraviolet ranges.
The explanation in the light of quantum theory is that atomic electrons can occupy only discrete energy levels but they may transition between them by absorbing/losing energy. In a flame test atomic electrons in the sample gain energy from the heating process and transition into higher energy levels. They subsequently transition to lower energy levels but in order to do so the energy must be released. The energy is released in the form of photons, which are discrete amounts of electromagnetic energy.
The energy levels are discrete (so there is not an infinite number of levels in any given atom). And the atoms of any given element have a set of identical and unique energy levels. Therefore the electrons of a specific atom can only produce a certain set of photons. Hence when a sample of an element is burned the same spectrum is observed each time.