Short maths version at end
Consider the self-adjoint operator (the occupation number operator that forms the Hamiltonian of the quantum harmonic oscillator) $$N = a^\dagger a$$ Where $a$ and $a^\dagger$ are the "creation" and" annihilation" operators satisfying $[a, a^\dagger ]=1$. It can be shown that the eigenvalues of this operator are $n \in \mathbb{N} $ and the associated eigenstates are denoted $|n\rangle$.
Now in physics we appeal to the spectral theorem, so that the eigenstates of a self-adjoint bounded operator are complete in the Hilbert space so that, for example, the identity admits a decomposition $$I = \sum_{n=0}^\infty |n\rangle \langle n|, $$ or an arbitrary state can be written as a linear combination of the eigenstates $$|a\rangle = \sum c_n |n\rangle $$ for coefficients $c_n$.
However as far as I can tell, the number operator is not bounded - there is no real number $K$ such that $$| \, N|n\rangle \, | < K|\, |n\rangle\, | ~~ \forall n$$ where the vertical lines indicate the norm on the Hilbert space. This is because the eigenvalues of the operator have no upper bound and the states are normalised to unity.
So why does the spectral theorem apply? Is there a generalisation to unbounded operators with nice (which?) properties? Or am I mistaken and the operator is bounded after all?
Mathematicians' version:
Suppose there is a linear self-adjoint operator $N: H \rightarrow H$ mapping a vector space over $\mathbb C$ to itself with eigenvectors $v_n$ satisfying $N v_n = n v_n$ for n a natural number. It seems N is unbounded yet a version of the spectral theorem holds so that the eigenvectors are complete.