Answer:
You determine the valence electrons by using the Periodic Table.
Let's assume you're using a table that has the groups numbered 1-18.
The electron configurations of ions are those of the neutral atoms plus or minus a number of electrons equal to the charge on the ion.