1.Magnesium (Mg) has two electrons in its outer shell. Mg will try to give two electrons to another atom (because the Mg is metal).
2. When an atom loses electrons, it becomes positively charged because its protons outnumber its electrons. ( In an atom, number of protons = number of electrons, when electrons are lost, the number of protons >the number of electrons.)