In this paper we describe the spherical harmonic transit telescope, a novel formalism for the analysis of transit radio telescopes. This all-sky approach bypasses the curved sky complications of traditional interferometry and so is particularly well suited to the analysis of wide-field radio interferometers. It enables compact and computationally efficient representations of the data and its statistics that allow new ways of approaching important problems like map-making and foreground removal. In particular, we show how it enables the use of the Karhunen-Loeve transform as a highly effective foreground filter, suppressing realistic foreground residuals for our fiducial example by at least a factor twenty below the 21cm signal even in highly contaminated regions of the sky. This is despite the presence of the angle-frequency mode mixing inherent in real-world instruments with frequency-dependent beams. We show, using Fisher forecasting, that foreground cleaning has little effect on power spectrum constraints compared to hypothetical foreground-free measurements. Beyond providing a natural real-world data analysis framework for 21cm telescopes now under construction and future experiments, this formalism allows accurate power spectrum forecasts to be made that include the interplay of design constraints and realistic experimental systematics with twenty-first century 21cm science.