Combination of Ions
As stated before when metals and non metals react the metals lose electrons and the non-metals gain electrons. The result is ions which are attracted by electrostatic forces of attraction (forces of attraction between opposite charges).
Examples are shown below:
1) Sodium and Chlorine combine the result is sodium chloride.
Na+ + Cl- → NaCl
It should be noted that the sum of the charges is equal to 0, as a result NaCl has no charge.
2) Magnesium and Oxygen
Mg2+ + O2- → MgO
3) Lithium and Oxygen
2Li+ + O2- → Li2O
In the examples above, you may be wondering why there are 2 Lithium atoms and 1 Oxygen. Well, the answer here is simple. Oxygen needs to gain two electron and lithium needs to lose one electron. This results in one oxygen bonding to two lithium atoms. Also, you will realize that lithium oxide (Li2O) has no charge similarly with the above as the charges cancel.