The number of valence electrons is just how many electrons an atom has in its outer shell. It's easy to figure out if you've got a periodic table. (See the link below this answer for a good periodic table).
All the elements in each column have the same number of electrons in their outer shells. All the elements in the first column all have a single valence electron (H, Li, Na, K, etc.).
The second column elements all have 2 valence electrons (Be, Mg, Ca, Sr, etc.).
Skipping over the gap, go to the Group 3 elements, which all have 3 valence electrons (B, Al, Ga, etc.).
The elements in the next column (C, Si, Ge, etc.) all have 4 valence electrons.
The elements in the next column (N, P, As, etc.) all have, yes, you guessed it, 5 valence electrons.
O, S, Se, and the others in this column have 6 valence electrons.
The halogens in the next-to-last column (F, Cl, Br, etc.) have 7 valence electrons.
The noble gases in the right-most column (Ne, Ar, Kr, etc.) all have 8 electrons in their out except for He, which only has 2 electrons.
If an atom is an ion, you must include the charge also:
For a positive ion, for each charge subtract one electron, *for instance, Na
+ has 1-1 = 0, BUT it has 8 valence electrons
because it has the same electron configuration as Ne. Just as K
+ has the same configuration as Ar. Therefore, the alkali metal ions with a single positive charge will have 8 valence electrons.
For a negative ion, add one electron for each charge, for instance, O
2- has 6+2 = 8 valence electrons