Given the Hilbert space $L^2([-\pi,\pi])$.
Consider the orthonormal system: $$\mathcal{S}:=\{\frac{1}{\sqrt{2\pi}}e^{ikx}:k\in\mathbb{Z}\}$$ This is an ONB. How do I prove this?
I guess, I could try to check that: $$f\in\mathcal{L}^2([-\pi,\pi]):\quad\int_{[-\pi,\pi]}f(x)e^{-ikx}dx=0\implies f=0\quad\lambda\text{-a.e.}$$
Stone-Weierstrass, basically.
You can check that these functions form an algebra that separates points, contains constant functions, and is closed under complex conjugation. The interval is compact, thus this algebra is dense in $C([-\pi,\pi])$ in the supremum norm, thus in the $L^2$ norm. Further, the continuous functions are dense in $L^2$, so this forms a basis.
It is a further theorem that a basis of a Hilbert space will satisfy the completeness property you have stated.
For more reading, see Folland Real Analysis, Chapters 4, 5, and 8.