The shape of a covalent molecule or an ion depends on the repulsion of the electron pairs around a central atom. The electron pairs are charge clouds around an atom and they repel each other as far as possible. There are two types of electron pairs, a bonding pair of electrons and a lone pair (non-bonding pair) of electrons.
The order of strength of the repulsions experienced by the electron pairs is: lone pair - lone pair > lone pair - bonding pair > bonding pair - bonding pair