We use Lewis structures along with Valence Shell Electron Pair Repulsion Theory to predict the structures of molecules. The idea behind this is that electrons in filled orbitals will repel each other because they have the same charge (just as magnets with the same polarity repel).
The electron pairs on the central atom will be arranged in such a way as to maximize their distance to the others. Two pairs will always be 180 degrees apart, in a linear arrangement. Three pairs will be 120 degrees apart in a trigonal arrangement. Four pairs will be arranged in a tetrahedron, 109 degrees apart. When there are 5 pairs of electrons, there are two possible arrangements: trigonal bipyramidal (90 and 120 degree angles) and square pyramidal (90 degree angles). Trigonal bipyramidal is the lowest energy, but the square pyramidal structure is pretty close and is also important. When there are 6 pairs of electrons, they occupy the vertices of an octahedron (90 degree angles).
Methane and ammonia both have 4 electron pairs, arranged in a tetrahedron. Only three of those pairs are bonded to another atom in ammonia. Borane has 3 electron pairs and must be trigonal.
Coordination GeometryBoth bonding and non-bonding electron pairs determine the structure but we name the geometry of molecules according to the arrangement of atoms.
The true bond angles will usually be distorted from the idealized angles in the pictures above because all bonds and non-bonding electron pairs don't have the same "size".
Also, atoms that are bonded to a central atom make a difference. The I atoms are much larger than the H atoms in CH2I2 and the H-H angle is smaller than the ideal 109 deg while the I-I angle is larger.