Ostensibly, you look up the half-reaction potentials associated from a Reduction Potential Table. The plausible reactions are:
Mg2+ +2e- → Mg (red'n -2.37 V - really not an option with alternative available)
2Cl- → 2e- + Cl2 (oxid'n -1.36)
2e- + H2O → H2 + 2OH- (red'n -.83 V which is what happens at cathode)
2H2O → O2 + 4e- + 4H+ (oxid'n -.4 V, which is what is expected to happen at the anode)
The half-reactions with the lowest magnitude negative potential (or positive if present) are supposed to happen at the electrodes. So the prediction is that you electrolyze water into its elements. In practice, you don't use chlorides as electrolytes to do this - the concentration of chloride ions builds up at the anode (changing the potential (by moving the equilibrium towards forming chlorine gas) and you generate chlorine gas instead of oxygen. The standard potential are for 1M ion concentrations.
Please consider a tutor. Take care.