General derivations of the equipartition theorem can be found in many statistical mechanics textbooks, both for the microcanonical ensemble and for the canonical ensemble. They involve taking averages over the phase space of the system, which is a symplectic manifold.