In quantum mechanics on the real line, we start with a potential $V: \mathbb{R} \to \mathbb{R}$ and try to solve the Schrödinger question $i\hbar \frac{\partial}{\partial t}\Psi(x,t) = - \frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}\Psi(x,t)+V(x)\Psi(x,t)$. In many cases this can be accomplished by seperating variables, in which case we obtain the equation $E\Psi(x,t) = - \frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}\Psi(x,t)+V(x)\Psi(x,t)$ which we try to solve for $E$ and $\Psi$ to obtain a basis for our space of states together with an associated energy spectrum. For example, if we have a harmonic oscillator, $V(x) = \frac{1}{2}m\omega^2x^2$ and we get $E_n = \hbar \omega (n+\frac{1}{2})$ and $\Psi_n$ a certain product of exponentials and Hermite polynomials. We assume that the energy in normalized such that the lowest energy state has energy $0$.
If the states of our system are non-degenerate, i.e. there is only one state for each energy level in the spectrum, then the partition function in statistical mechanics for this system is given by the sum $Z(\beta) = \sum_n \exp(-\beta E_n)$, where $\beta$ is the inverse temperature $\frac{1}{k_B T}$. It is clear that this sum can be divergent; in fact for a free particle ($V = 0$), it is not even well defined since spectrum is a continuum.