Writing the electron configuration of an atom allows you to work out the electron configuration of the ion and therefore the charge on the ion.
Examples:
Atom = Mg
Electron configuration = 2,8,2
remove the two electrons from the outer shell to achieve the same electron configuration as the nearest noble gas, Neon (Ne 2,8)
Ion = Mg2+
[2,8]2+
Atom = O
Electron configuration = 2,6
add two electrons to the outer shell to achieve the same electron configuration as the nearest noble gas, Neon (Ne 2,8)
Ion = O2- [2,8]2-