Energy levels in hydrogen and the emission of radiation
When an atom is excited by a pulse of radiation an electron will jump from the ground state to an excited level. It remains there for a short time and then falls to a lower level and some of its energy is converted into a pulse of radiation which leaves the atom. The bigger the energy drop the shorter the wavelength of the emitted radiation.
A large energy drop will give a pulse of high frequency, short wavelength violet light while a small energy drop results in a pulse of lower frequency, long wavelength red light or even infra red.
The animation happens very much more slowly than real transitions in an atom to make it easier for the observer to follow. In reality the electron may only stay in an excited state for a millisecond or so. The atom could also be excited by electricity, heat or by collision with another atom.