Because magnesium(Mg) has 2 valence electrons(ve-) it will lose them and form a 2+ cation.
Chloride(Cl-): Each Cl atom has 7 ve- and steals 1 electron to complete its octet. Each chloride ion has a -1 charge.
So, in order to steal balance out the charge of Mg (2+) we need 2 chloride ions ionically bonded to each Magnesium ion. We will form
[tex]MgCl_{2} [/tex]
Therefore, we will have a ratio of 1:2 [tex]Mg^{2+} [/tex]:[tex]Cl^{-} [/tex].
Make sense? If you have any further questions please comment back. :)