Extra energy added to atoms and molecules is emitted when the excited electrons fall back to lower energy states. The light emitted has wavelengths and colors that depend on the amount of energy originally absorbed by the atoms.
Different elements emit different emission spectra when they are excited because each type of atom has a unique energy shell or energy level system. Each element has a different set of emission colors because they have different energy level spacings. Work the experiment, Light and Element Identification [local].