We present a rigorous investigation on how to optimize the degrees of freedom of optical polarization mode dispersion (PMD) compensators composed of differential group delay sections and polarization controllers, up to two stages. The analytical treatment relies on the extracted Jones matrices of the transmission and compensation fibers. The analysis of a single-stage compensator with two degrees of freedom (fixed DGD) is based on the maximization of the eye opening, as provided by the generalized Chen formula. The outage probability is quantified through a fast semi-analytical technique. It is shown how the benefits of single-stage compensation are strongly reduced and can lead to outage events, when certain critical input states of polarization are launched into transmission fibers with strong eigenmodes depolarization (i.e., strong higher order PMD). Focusing on such transmission fibers and input configurations, a novel algorithm is introduced for controlling a double-stage compensator with five degrees of freedom. The algorithm is based on an ideal equalization of the transmission fiber at half the bit-rate, realized resorting to spherical geometry. To this aim, we show that the first compensator stage must be a PMF fiber with very large DGD, equal to the bit period, in order to compensate the most critical configurations associated with outage events.