How is the formation of the salt MgCl_2 rationalized on the basis of the Periodic Table?

If the metal is in Group II, then it has $2$ valence electrons. As does beryllium, calcium, barium, and strontium etc. How do you know this? Look at the Periodic Table, of which you should have several copies on your desk and your wall; you will also be provided a copy in your examination. As atomic magnesium it tends to lose 2 electrons to form $M {g}^{2 +}$.
On the other hand, atomic chlorine has 7 valence electrons (as does fluorine and bromine). Chlorine can be (fairly easily) reduced to the chloride ion, with 8 formal valence electrons. Why should it accept electrons? For a start it is a non-metal to the right of the Periodic Table, and its nuclear charge attracts electrons. The ease of reduction with respect to chlorine, and the relative ease of oxidation of the magnesium atom to $M {g}^{2 +}$ can help rationalize formation of the NEUTRAL salt, $M g C {l}_{2}$,