The valence shells of a transition metal are filled when they contain 18 electrons: 2 each in the 5 d orbitals, or 10 total; 2 each in the 3 p orbitals, or 6 total; and finally 2 in the single valence shell s orbital.
The electrons contributed by the metal atom or ion are summed with the electrons contributed by each ligand (ie, those valence electrons of each ligand participating in some way in a bonding interaction with the metal, and not otherwise occupied only in intraligand bonding or in lone-pairs not interacting with the metal center).
A compound or ion which satisfies this 18 electron rule is considered to be qualitatively more stable than other configurations or electronic states of the molecule.
There are two different approaches one can use when counting electrons, each arriving at the same total. The constituents (ie, metal and ligands) can be regarded as ions, or as neutral species.
Using ferrocene as an example, and using the neutral approach first, the iron atom has 8 valence electrons. Each of the two cyclopentadiene radicals contributes 5 electrons, totalling 10 electrons from the ligands.
10+8=18Using the ionic approach, iron is taken in its common oxidation state Fe2+, contributing only 6 valence electrons. However, the cyclopentadiene moieties are counted as aromatic cyclopentadiene anions, contributing 6 electrons each as well.
6+6+6=18The utility of electron becomes more apparent when one considers what chemical transformations or derivatives might be readily accessible. For example, what piano stool compound might one be able to create by formally removing one of the cyclopendatienyl ligands from ferrocene and replacing it with some number of carbon monoxide ligands?
Using the ionic approach, removing one cyclopentadienyl anion yields a cationic fragment containing one cyclopentadienyl (Cp) fragment and 12 valence shell electrons. Since each carbon monoxide ligand contributes 6 electrons, it should be possible to create an iron-containing complex cation containing one cyclopentadienyl group, one iron atom, and 3 carbon monoxide ligands:
What one finds is that the iron complex satisfies the 18 electron count another way, by forming a dimer with an Fe-Fe bond. Counting electrons for just one iron center can be done by considering the other iron as contributing 1 electron to the count
Cp 5 Fe 8 CO 4 Fe 1 ---- 18