In order for an electron to jump into a higher energy state, it must first absorb energy (heat, light, etc).
When an electron goes back down to the ground state from the excited state, it emits energy usually in the form of a photon.
i hope this helps