Visualizing Electron Orbitals
Rough sketches of the electron density for the first three shells of the hydrogen atom can give an impression of the constraints that govern the buildup of the periodic table. The limits on the occupation of the subshells arise from the quantum numbers for the atomic electrons and their relationship to each other. These sketches arise from the hydrogen wavefunctions which map the electron density.
The numbers of the main shells, like 1s, arise from the principal quantum number n in the quantum mechanical description of the electrons. The letters designate the sub-shells and follow the historical spectroscopic notation. In general terms, the higher shells have higher energy (less tightly bound) and are on the average further out from the nucleus. This is strictly true for the hydrogen atom where the energy levels depend only upon the principal quantum number (fine structure neglected). But in larger atoms, the energy depends also upon the orbital quantum number so the sub-levels are filled in the order s, p, d, f, etc. This spreading eventually leads to overlap, with the 4s sub-level being lower in energy than the 3d sub-level.
The division into main shells encourages a kind of "planetary model" for the electrons, and while this is not at all accurate as a description of the electrons, it has a certain mnemonic value for keeping track of the buildup of heavier elements.
Perhaps a better way to keep track of the buildup process is to just track the filling of the states, emphasizing the order of buildup and the fact that the states are definite, quantized energy states. The Pauli exclusion principle tightly constrains the entire buildup process, allowing only one electron to occupy each available state. Since all of nature tends to the lowest energy state, the individual states will fill in the order of ascending energy.
The filling of the 2p orbital places eight electrons in the second shell, a "stable octet". The particularly stable configuration produces the noble gas neon. But fluorine with one less than a stable octet is very active! It tends to gain one electron while the very active sodium tends to lose one electron, in each case producing the stable octet configuration of neon.
The electron orbital configurations provide a structure for understanding chemical reactions, which are guided by the principle of finding the lowest energy (most stable) configuration of electrons. We say that sodium has a valence of +1 since it tends to lose one electron, and chlorine has a valence of -1 since it has a tendency to gain one electron. Both of these atoms are very active chemically, and their combination is the classic case of an ionic bond.
The chemical compounds involving elements in the first three rows of the periodic table can be well understood with the kind of orbital considerations above. Things become more complicated in the fourth row of the periodic table. The 4s electrons dip down below the 3d electrons in energy, and since there are ten possible quantum number combinations in the d sub-shell, this inserts 10 elements between the 4s and 4p subshells, the so-called "transition elements".