Racemic mixture is optically inactive due to the fact that in equimolecular mixture of enantiomeric pairs, the rotation caused by the molecules of one enantiomer is cancelled by the rotation caused by the molecules of other enantiomer.
This type of compensation of optical rotation in a racemic mixture is called as external compensation.
This is the reason why racemic mixture becomes optically inactive.