Mode Expansion in Equilibrium Statistical Mechanics. I. General Theory and Application to the Classical Electron Gas | Synapse