Note that if an atom loses an electron, its number of protons becomes larger than the number of electrons.
Thus, the atom assumes a positive charge, turning into a positive ion, called cation.
Consider again the sodium atom:
When the sodium atom loses an electron, it becomes a positively charged ion (+1). If the process is inverse, that is, the atom receives an electron, the number of electrons becomes higher than that of protons and the atom takes a negative charge, becoming a negative ion, called anion.
Now notice the chlorine atom:
In this example, the charge of the chlorine ion becomes -1 because its source atom received an electron.
The amount of charge of a cation or anion may vary according to the number of electrons the parent atom has lost or received. Thus, it is possible to verify the existence of charged ions +1, -1, +2, -2, +3, -3 etc.
Here's an example, considering the magnesium atom: