electron configuration
If electrons all crowded as close to the nucleus as possible, every element would behave the same. They do not. Electrons stack into a set of allowed energy levels called shells and subshells, a bit like guests filling a theatre from the front rows outward: the cheap front seats fill first, and only when a level is full do electrons move to the next. The electron configuration is simply the seating chart — which levels are filled and how full each one is.
The shells are numbered 1, 2, 3, ... outward, and each contains subshells labelled s, p, d, f that hold at most 2, 6, 10, and 14 electrons respectively. Electrons fill from lowest energy upward. Sodium, with 11 electrons, is written 1s2 2s2 2p6 3s1: two in the first shell, eight in the second, and a lone electron starting the third. That lonely outer electron is exactly what makes sodium reactive and metallic.
The configuration is the bridge from a bare proton count to real chemistry. Elements with similar outer configurations behave alike, which is the whole reason the periodic table has columns. A filled outer shell (as in neon, 1s2 2s2 2p6) is unusually stable and unreactive — the atom has no incentive to bond, which is why the noble gases are chemically aloof.
Chlorine (17 electrons) is 1s2 2s2 2p6 3s2 3p5 — its outer shell holds 7 of the 8 it could, so it badly wants one more. Argon (18 electrons) is 1s2 2s2 2p6 3s2 3p6 — a full outer shell, and it wants nothing. One extra electron separates a violently reactive gas from an inert one.
Sodium 3s1 and chlorine 3p5 explain why NaCl forms so readily.
The tidy filling order has famous exceptions among the transition metals (chromium and copper, for instance), because half-filled and filled d-subshells are extra stable. The rule is a strong guide, not an unbreakable law.