Why do shells further from the nucleus have higher energy than those closer?Watch this thread
It really confuses me and I can't find an explanation for it. And how does it help explain why electrons are attracted to the nucleus but not drawn into it?
However, the energy well is actually quantised, not continuous. The electron can only take certain values of energy. Those values are determined by solutions of the Schrodinger equation and are defined by the quantum numbers of that electron (n, m, l and s). Each combination of quantum numbers give rise to a particular "orbital" (e.g. the 5d orbital has n=5, m=2, l=+2 through -2, and s=+1/2 and -1/2).
Now the the lowest the energy most stable the atom is. Therefore the energy levels closest to the nucleus are filled first to keep the energy of the atom lowest to achieve most stable state.
To gain height stability the the first electron goes to the closest energy level which has lowest energy because of the electrostatic forces between the nucleus and electrons in it. Once the first level is full (only two electron) then the next available level with lowest energy (again closest to opposite charged nucleus) is the second energy level and so on.