A shared electron pair sits between two nuclei, and each nucleus pulls on it. If the pulls are equal, as in H2 or Cl2, the pair sits in the middle. If one atom pulls harder, the pair shifts toward it. Electronegativity, written χ, is a number for how hard an atom pulls: sodium 0.93, hydrogen 2.20, carbon 2.55, nitrogen 3.04, oxygen 3.44, fluorine 3.98.
The trend follows the structure of the atom. Across a period, the nucleus gains protons while the outer electrons stay in the same shell, so the pull on bonding electrons grows, from lithium (0.98) to fluorine (3.98). Down a group, the outer shell sits farther out and is shielded by more inner electrons, so the pull weakens: fluorine 3.98, chlorine 3.16, bromine 2.96, iodine 2.66. The strongest pullers sit at the top right, apart from the noble gases, which rarely bond and are usually given no value.
Electronegativity is not electron affinity. Electron affinity is an energy, in kJ/mol, released when a lone gas-phase atom gains an electron; electronegativity is a unitless ranking of pull within a bond. The two usually agree on order but not always: chlorine's electron affinity is larger than fluorine's (349 against 328 kJ/mol), yet fluorine is more electronegative. For electrons in a bond, use electronegativity; for an isolated atom gaining an electron, use electron affinity.
Think of it like this. Electronegativity works like two magnets of different strength pulling on one steel ball between them: the ball settles closer to the stronger magnet, stays in the middle if the magnets match, and jumps across entirely if one is far stronger, which is the ionic case. The values are relative ratings, not forces you can measure directly.
Core idea. Each atom pulls on shared electrons with a characteristic strength that rises toward fluorine; the difference between two atoms' values predicts whether their bond is evenly shared, polar, or ionic.