Atoms tend to be chemically stable when each electron shell is either empty or full. Partly filled shells are unstable. To put the point in anthropomorphic terms, atoms are a little obsessive-compulsive about their electron shells. Nobody wants a partly filled shell! Partly filled shells are annoying. So atoms like to bargain with each other, working out deals to share or exchange electrons, so that everyone can be happy.
Electrons that inhabit a partly-filled shell are called valence electrons. Valence electrons are involved in the formation of chemical bonds between atoms, so it is helpful for chemists to know how many valence electrons each type of atom has. To determine the number of valence electrons in any type of atom, find the element on the periodic table, and count across that row from the left side, as done in the examples below. (This works for all elements except noble gases, which have no partly-filled shells and therefore no valence electrons.)
How many valence electrons does sodium have? Sodium is the first element in the third row. Since it’s the first element in its row, it has just one valence electron.
How many valence electrons does neon have? None. It’s a noble gas, so it has no partly-filled shells and therefore no valence electrons.
Atoms of hydrogen and the alkali metals, which are listed in the first column of the periodic table, each have one valence electron. These elements are eager to give away that valence electron in a chemical reaction. Consider lithium, for example. To avoid the disgrace of having a partly-filled shell, lithium could either give away its valence electron (thereby emptying its second shell) or collect seven more (to fill that shell, which can hold eight). Well, you don’t have to be a lithium atom to know that giving one electron away is much easier than begging your friends for seven of theirs! Similarly, the element calcium (the second element in the fourth row) could either give away its two valence electrons to empty its fourth shell, or collect sixteen more to fill that shell. Giving away two is much easier than collecting sixteen, of course, so calcium strongly prefers to give its two valence electrons away. On the other hand, elements toward the right side of the periodic table, like oxygen and fluorine, find it easier to fill their shells (by adding an extra electron or two) rather than getting rid of their many valence electrons.
Thus, elements toward the left side of the periodic table (metals) tend to give away valence electrons, while elements toward the right side (non-metals) tend to collect them. An exception is the rightmost column. These elements, called the noble gases, are happy just the way they are. Helium, for instance, has a completely full inner shell, and all of its other shells are completely empty. Similarly with neon. Its first two shells are full, and the remaining shells are empty. Helium, neon, and the other noble gases like it that way: no partly-filled shells! So noble gases generally don’t engage in chemical reactions at all. Nobles rarely deign to mingle with the commoners!
It is also worth noting that elements toward the bottom left and top right corners of the periodic table tend to be more highly reactive (again, excluding the noble gases). The element francium (at the bottom left corner) is the most reactive metal; fluorine (near the top right) is the most reactive non-metal. To understand why this is so, consider the following. Electrons are attracted to the nucleus but repelled by each other. The more electrons an atom has, the less difference the pull of the nucleus makes. Although francium has a lot of positively-charged protons in its nucleus, it also has a lot of electrons. So, from the perspective of any individual electron, the rest of the atom seems almost neutral: it’s only slightly attractive. Moreover, electrons with higher energies can more easily escape the pull of the nucleus and get away. And francium’s valence electron is stuck on a very high-energy shell. It can’t fall to lower shells, because those shells are already full! That sad, lonely valence electron is all too eager to escape.
Fluorine, in contrast, has just one empty spot left in its second shell. Fluorine is anxious to fill that spot so it can feel all smug and self-satisfied like its next-door neighbor neon. And from the perspective of a wandering electron, the second shell of a fluorine atom is a pretty attractive place to live. The energy bill is cheap (relatively little energy is required to reach the second shell), and there aren’t too many other electrons around. What electron wouldn’t want to retire there?