In the kinetic theory of gases, kinetic energy is assumed to purely consist of linear translations according to a speed distribution of particles in the system. However, in real gases and other real substances, the motions which define the kinetic energy of a system (which collectively determine the temperature), are much more complex than simple linear translation due to the more complex structure of molecules, compared to single atoms which act similarly to point-masses. In real thermodynamic systems, quantum phenomena play a large role in determining thermal motions. The random, thermal motions (kinetic energy) in molecules is a combination of a finite set of possible motions including translation, rotation, and vibration. This finite range of possible motions, along with the finite set of molecules in the system, leads to a finite number of microstates within the system; we call the set of all microstates an ensemble. Specific to atomic or molecular systems, we could potentially have three different kinds of ensemble, depending on the situation: microcanonical ensemble, canonical ensemble, or grand canonical ensemble. Specific combinations of microstates within an ensemble are how we truly define macrostate of the system (temperature, pressure, energy, etc.). In order to do that, we must first count all microstates though use of a partition function. The use of statistical mechanics and the partition function is an important tool throughout all of physical chemistry, because it is the key to connection between the microscopic states of a system and the macroscopic variables which we can measure, such as temperature, pressure, heat capacity, internal energy, enthalpy, and entropy, just to name a few. (Read: Partition function Meaning and significance)
Using the partition function to find the energy of a molecule, or system of molecules, can sometimes be approximated by the Equipartition theorem, which greatly-simplifies calculation. However, this method assumes all molecular degrees of freedom are equally populated, and therefore equally utilized for storing energy within the molecule. It would imply that internal energy changes linearly with temperature, which is not the case. This ignores the fact that heat capacity changes with temperature, due to certain degrees of freedom being unreachable (a.k.a. "frozen out") at lower temperatures. As internal energy of molecules increases, so does the ability to store energy within additional degrees of freedom. As more degrees of freedom become available to hold energy, this causes the molar heat capacity of the substance to increase.