Step-by-step explanation:
When beam of light passes through any material, electrons present in the atoms of the of the material absorbs photon and re-emits them. During this process electrons changes their orbit and falls back and emits light(photons) of a particular wavelength which determines colour of the spectrum and hence we can observe change in orbit of electrons and their current position. Thus determining structure of atom and also the nature of the material.