Atoms bond to reach a more stable, lower-energy arrangement, usually the electronic configuration of a noble gas. How an atom bonds depends on how strongly it holds its own electrons and attracts others. Four properties measure this: atomic radius, ionisation energy, electron affinity and electronegativity.
An ionic bond forms when a metal atom transfers electrons to a non-metal atom and the oppositely charged ions attract each other. A covalent bond forms when two atoms share electrons: one, two or three shared pairs give single, double or triple bonds.
In a coordinate covalent bond both shared electrons come from one atom, the donor. The other atom, the acceptor, has room for the pair.