Part of the genius of Lewis' system is that he recognized that only valence electrons are involved in bonding and that therefore only valence electrons needed to be represented to understand the bonding of a molecule. Valence electrons are those that are on the outermost energy level of the atom.
To understand this idea, let's look at nitrogen. The electron configuration of nitrogen is 1s22s22p3. Level 2 is the highest energy level represented, so only the 2s and 2p electrons are valence electrons. In short, nitrogen has 7 electrons, but only 5 valence electrons. Remember from our understanding of the periodic table that elements that have similar electron structures are grouped vertically on the table, so if we examine phosphorus (1s22s22p63s23p3) we discover that its valence level is 3 and it also has 5 valence electrons. Each column of the table works this way, so that hydrogen, lithium, sodium, potassium, rubidium, cesium and francium all have 1 valence electron, while neon, argon, krypton, xenon and radon all have 8 valence electrons. The number of valence electrons is easy enough to figure out, but most periodic tables make it even easier with the number of valence electrons written (often in roman numerals) at the top of each column. In addition, metals generally make ionic bonds, not covalent bonds, so we generally will not be concerned about the number of valence electrons in the s block of the table or the transition metals.