Metals donate (give away) electrons, non-metals receive or accept them. The objective for both is to finish up with full shells, so elements with less electrons than spaces in the outermost shell will tend to give them away, and elements with less spaces than electrons will tend to receive them.
It’s all here….. ionic-bonding is a Word document that walks you through all the basic ideas.
In exams, when you’re asked to draw diagrams like this, you must show where the electrons go with arrows like in the diagram. Ionic compounds form giant (lattice-like) structures which conduct electricity when either molten or dissolved because the ions are charged and are mobile. They have high mp’s and bp’s because a lot of energy is required to break a lot of bonds.