The number of electrons lost or gained determines the charge of the ion:
Positive ions are called cations.
Sodium is in group 1. A sodium atom has one electron in its outer shell. The atom is more stable if it has a full outer shell.
A sodium atom can lose its outer electron. It will still have 11 positive protons but only 10 negative electrons. So, the overall charge is +1.
A positive sign is added to the symbol for sodium, Na+. Ions with greater charge include a number in their symbol, for example Al3+ (which has three positive charges).
Magnesium is in group 2.
The atomic number of lithium is 3. Its mass number is 7. How many protons, neutrons and electrons are there in a lithium ion?
Going down group 1, the outer electron is further away from the positive nucleus. It is also shielded from the nucleus by more electron shells. Because of this, it becomes easier to lose the outer electron, so the elements get more reactive moving down the group.