Atoms consist of protons and neutrons in the nucleus, surrounded by electrons that reside in orbitals. Since electrons are wave-like in behavior, it is impossible to determine the exact position of an electron. Instead, orbitals describe regions in space where electrons are likely to reside. Orbitals are classified according to the four quantum numbers that represent any one particular orbital's energy, shape, and orientation. Electrons fill up these orbitals in a systematic fashion, with two electrons per orbital.
When considering the electron configuration of atoms it is useful to consider the valence electrons separately from the inner electrons, since much of the chemistry that elements undergo occurs as a result of the octet rule. The octet rule is the tendency for atoms to gain a full valence shell of electrons. For that reason, elements with similar valence shell configurations have similar chemical properties, giving rise to much of the periodicity of the Periodic Table.
Two such period properties are an atom's ionization energy and its electron affinity, which are the energies involved when an atom loses and gains electrons, respectively. An atom's ionization energy and electron affinity determine how easily that atom can lose or gain electrons and thereby form ions with a full valence shell. In gaining and losing electrons atoms also can become positively or negatively charged. When positive and negative ions interact, this gives rise to attractive forces that form the basis of ionic bonding.