electron configuration
An atom's electron configuration is the list of which orbitals its electrons occupy — like a seating chart that says, row by row, where everyone sits. For oxygen it reads 1s2 2s2 2p4: two electrons in the 1s orbital, two in the 2s, and four spread over the 2p orbitals. This single shorthand is the most useful fact you can know about an element, because almost everything chemical follows from it.
You build the configuration by filling orbitals in order of increasing energy, two electrons (with opposite spin) per orbital, until you have placed all the atom's electrons. The filling order roughly follows the rows of the periodic table; this is the aufbau ("building-up") principle. To keep it short, chemists abbreviate the inner filled shells with the previous noble gas in brackets: iron is [Ar]3d6 4s2 rather than the full 1s2 2s2 2p6 3s2 3p6 3d6 4s2. The outermost electrons — the valence electrons — are the ones that do chemistry; the inner core mostly just sits there and screens the nucleus.
Configuration is the bridge between an element's place on the table and its behaviour. Sodium ends in 3s1 (one loose electron, eager to be lost — a reactive metal); chlorine ends in 3p5 (one electron short of a full shell, eager to grab one — a reactive nonmetal); neon ends in a full 2p6 (content, inert). For transition metals it explains variable oxidation states and colour. A genuine subtlety: the famous 4s-before-3d filling rule has real exceptions (chromium is [Ar]3d5 4s1, copper is [Ar]3d10 4s1) because half-filled and full d-subshells carry extra stability — so treat the rule as a strong guideline, not an unbreakable law.
Iron: [Ar]3d6 4s2. When it forms Fe2+ it loses the 4s electrons first, giving [Ar]3d6 — not [Ar]3d4 4s2.
Transition metals fill 4s before 3d, but lose 4s first on ionising.
The 4s-fills-before-3d / loses-first puzzle is real: once 3d electrons are present the orbital energies reorder, so the rule that builds the neutral atom is not the rule for the cation. It is a sign that simple filling diagrams are approximations.