Do states with infinite average energy make sense? Do states with infinite average energy make sense?
For the sake of concreteness consider a harmonic oscillator with the Hamiltonian $H=a^\dagger a$ and eigenstates $H|n\rangle=n|n\rangle$, $\langle n|m\rangle=\delta_{n,m}$. Then prepare a state
$$|\psi_m\rangle = c \sum_{n=1}^\infty\frac1{n}|n^m\rangle,\qquad m\in\mathbb{N}.$$
This state is normalizable (with normalization constant $c^{-2}=\sum_{n=1} \frac1{n^2}$) and hence seems to be an OK quantum state. However, its average energy
$$\langle\psi_m|H|\psi_m\rangle=c^2\sum_{n=1}^\infty n^{m-1}$$
is infinite for any $m\ge0$.
There is no direct contradiction here, but I have never thought about such states before and they seem puzzling. Do they make sense? Do they appear in theory/experiment? Does it take an infinite amount of energy to prepare such a state from the vacuum state?
 A: The infinite expectation value for the energy arises due to the fact that the harmonic potential extends to infinity. As a result one can keep going up the ladder of states indefinitely. Practically such an infinitely high potential cannot exist. After a certain energy level there are not going to be any bound states and you will be left with scattering states only.
So there is no contradiction and such unintuitive behaviour is a consequence of the unphysical nature of the potential. A similar thing happens with the infinite potential well where the first derivative of the wavefunction is discontinuous. Again theoretically no contradiction but physically unrealisable.
A: To interpret $\langle E \rangle = \infty$ one has to distinguish between the possible values, the expected value and the most probable value of energy.
All eigenvalues $\{1,2,3,\dots\} =\mathbb N$ of the Hamiltonian are possible energies for the state you suggest (with that $m=1$ of course). Every single eigenenergy is a finite number, but there is no highest energy, the spectrum is unbounded from above.
This state, however, has the lowest energy as the most probable one, and the probability decreases with increasing energy.
$$
(p_1,p_2,p_3,\dots) = \frac{1}{\sum_{n=1}^\infty \frac{1}{n^2}} \left(\frac{1}{1^2}, \frac{1}{2^2},\frac{1}{3^2},\dots \right)
$$
So the lowest energies are those one gets every day upon measurement of energy in that state.
Now for the expectation (or average value) it is (in general) not necessarily a possible value nor the most probable. Furthermore the distribution for this state has an indefinitely large mean value (with $E_n = n$)
$$
\langle E\rangle
= \sum_{n=1}^\infty p_n E_n
= \frac{\sum_{n=1}^\infty \frac{1}{n}}{\sum_{n=1}^\infty \frac{1}{n^2}} = \infty,
$$
but what you get with measurement is always a finite number in the spectrum.  It is still possible,  (in theory at least,) by chance, to measure as high energy as you like, as long as you keep measuring particles in that state forever, since it is unlikely to get those low  energies every day.
A: If you adopt the frequentist perspective, the fact that $\langle E\rangle$ does not exist simply means that if you measure the energies of $N$ identically-prepared systems and average the results, then that number does not approach a well-defined limit as $N\rightarrow \infty$.
If the spectrum of the Hamiltonian is unbounded (as it very often is), then such states must exist in the Hilbert space, so they certainly appear mathematically.  I personally don't find anything necessarily unphysical about them either; $\langle E\rangle \rightarrow \infty$ doesn't mean that any measurement returns infinity as a result, but rather that increasing the number of measurements tends to increase the average energy.
For example, consider a particle in a box of length $a$ with wavefunction $\psi(x) = 1/\sqrt{a}$. This corresponds to the position of the particle being completely unknown (other than the fact that it's in the box).  If you compute $\langle E\rangle$ in this state, you will find that it diverges to infinity.  The particle in a box is of course a mathematical idealization, but so is every model we ultimately use, and since this one is very plausibly a useful model I'm not so willing to write it off.

Your example is tricker than it seems since [$\psi$ does not satisfy the boundary conditions associated with the domain of $H$]

@ZeroTheHero raises an excellent point.  $H$ (whose domain is twice weakly differentiable functions with Dirchlet boundary conditions) is self-adjoint (as all Hamiltonians must be), but it is correct that the $\psi$ I've written down is not in its domain.  In this respect, we cannot write $\langle E\rangle = \langle \psi,H\psi\rangle$ simply because the right-hand side is illegal!
This does not necessarily mean that $\langle E \rangle$ is undefined, but it should make us suspicious.  The correct thing to do is to expand $\psi$ in terms of the normalized eigenvectors of $H$:
$$\psi = \sum_n c_n \phi_n \qquad H\phi_n = E_n\phi_n$$
which can always be done due to the self-adjointness of $H$. We then define $\langle E\rangle := \sum_n E_n |c_n|^2$.  It's easy to see that this coincides with $\langle \psi,H\psi\rangle$ when $\psi\in\mathrm{dom}(H)$, but is in fact slightly more general, and it is this calculation which diverges to infinity. Indeed, if we naively calculate $\langle \psi,H\psi\rangle$ by differentiating $\psi$ twice, we get zero.
