Why does spring energy count as a degree of freedom?
See above: “degrees of freedom” are described most generally as “ways a particle can have energy” (the energy doesn’t necessarily have to be kinetic). If you imagine two atoms connected by a spring, they can have kinetic energy with respect to one another. There is also a spring-like potential energy, which corresponds to another quadratic term in the total energy. Any kind of energy counts for the Boltzmann probability, and if you work out the average energy, that potential energy term also gives you .