The principal quantum number n of an orbital controls the average distance of the electron from the nucleus when it occupies that orbital. Thus the vertical scale on the illustration below corresponds to increasing (less negative) potential energy as you go up the page. In multi-electron atoms, repulsion between electrons causes some splitting of the orbitals having the same value of n but different shapes (different values of l ) into different energies as shown.
The pattern of this splitting is such that d orbitals having a principle quantum number of n have energies in the same range as the s and p orbitals belonging to the next lower value of n, or n-1. This complicates the simple picture of electron "shells" that is straightforward for s- and p orbitals of n=1 through n=3, and it profoundly affects the organization of the periodic table.
>With f orbitals, things get even more mixed up! Because of the energetic similarity of s, d and f orbitals having different values of n, the actual electron configuration of an atom whose highest occupied orbital is in this region may change with its chemical environment. The configurations given in tables generally refer to the isolated, gaseous atoms, and may not be representative of what occurs under more commonly encountered conditions.
Remember that each little box in this diagram (which encompasses n-values 1 to 7) represents a single orbital— a "state" of existence of an electron in an atom, characterized by a certain energy and shape. The shape describes how the probability of finding the electron at any location varies with radius and angle around the nucleus.
In the above diagram, the boxes refer to elements and not to orbitals directly. For example, the oxygen atom, which contains four electrons in 2p orbitals, is placed in the fourth box in the 2p group. If you think about it, this table provides a beautiful view of how the arrangement of the periodic table is a direct consequence of the number of orbitals of each type and their relative energies.
Now look at the representation of the first three rows of the periodic table shown below.
Electron configurations of the first eighteen elements are shown here along with the Lewis electron-dot formulas and valence shell occupancies. Note especially the following points:
For a more complete treatment, please see the Virtual Textbook chapter
Atomic Structure and the Periodic Table.