An alternative to the crystal field theory approach presented in Pritt Balagopal's answer is to make use of ligand field theory. Neither theory is perfect, and crystal field theory can explain many properties of coordination compounds (even if not always for the right reason).
Ligand Field Theory
Ligand field theory (LFT from here on in) is a newer and more in-depth way of considering the bonding/properties of coordination complexes, and was developed by combining crystal field theory (CFT) with molecular orbital theory (MO theory). The major difference is that the ligands are no longer considered as electrostatic point charges.
LFT works by taking the orbitals on the metal centre (s, p, d) and mixing them with a set of (symmetry adapted group) orbitals which represent the ligands (doing this requires some treatment with group theory). The process of doing this is a question in itself (and has been discussed on chem.SE previously), but what we really care about right now is the results obtained from the ligand field approach.
With LFT, the resulting diagram differs depending on the type of ligands involved (in CFT, there is an octahedral crystal field which is largely the same, irrespective of the ligand type, since all ligands are considered as point charges).
What remains the same is that we still end up with an eg MO and a t2g MO, its just that the orbitals used to obtain those are different depending on the ligand.
Fig 1: Ligand field diagrams for three common ligand types, reproduced from Ligand Field Theory and its applications, Figgis.
Once we have our ligand field diagrams, we simply have to fill with electrons (taking into account the metal and the ligands). If you go through and do this, you should end up with a diagram such as that in figure 2.
Fig 2: Filled ligand field diagrams, reproduced from Inorganic Chemistry, Meissler and Tarr.
On the left hand side of the above diagram, is the key portion of the filled ligand field diagram for the CN case, and on the right hand side, the key portion of the filled ligand field diagram for the F case.
From CFT, you still would have gotten to the fact that the t2g orbital ends up filled with 3 electrons in both cases. What differs (and where the power in LFT lies) is that we can now see where these electrons come from (i.e. the contributions).