When an atom is surrounded by six substituents, arranged in a manner that four are in one plane, one above and below, and their vertices join to give eight faces (octa-hedrons), such a molecular geometry is octahedral.
Since it looks like two pyramids projecting out from a square base, the geometry is also called square bipyramidal.
A perfect octahedral geometry when the central atom has no lone pairs is represented as an AX6 type in VSEPR theory. Here, all the substituent atoms will be 90o apart and equidistant from the central atom such that any rotations easily convert the positions and generate the same structure.
For example, any metal-ligand complexes and molecules like (Fe (H2O)6) +3, Mo(CO)6, and SF6 have perfect octahedral geometry.
When 1-4 lone pairs replace the substituent positions, the shapes change to the square pyramid, square planar, T-shaped, and linear, subsequently affecting the bond angles.
The lone pairs almost always occupy positions that allow maximum separation to avoid lone pair-lone pair and lone pair-bond pair repulsions.