In a first course on statistical mechanics the partition function is normally introduced as the normalisation for the probability of a particle being in a particular energy level. $$p_j=\frac{1}{Z}\exp\left(\frac{-E_j}{k_bT}\right)$$$$p_j=\frac{1}{Z}\exp\left(\frac{-E_j}{k_bT}\right),$$ $$Z=\sum_j \exp\left(\frac{-E_j}{k_bT}\right)$$$$Z=\sum_j \exp\left(\frac{-E_j}{k_bT}\right).$$ Through various manipulations (taking derivatives and so on) we can recover the macroscopic thermodynamic variables of the system. It seems a little fortuitous to me that without specificing more than $Z$ we can recover so much information about our system especially when it is introduced as normalisation.
Is there a better way to view the partition function other than the normalisation of probabilites? It just seems pretty amazing that it has so much information encoded about the system when really all it does is ensure that $\sum_j p_j=1.$