How can we prove that a Fourier Series exists? How does one show that an arbitrary periodic function, so long as it is reasonably well behaved, can always be represented as a sum of sine and cosine functions? It sounds like the first thing you would learn when it comes to Fourier Series but my text simply claims that this is true and goes on to tell me how to work out the coefficients. Can anyone help?
 A: As alluded to in the comments, it is probably too difficult to prove given what the text assumes you know. 
The basic idea is that $B = \{1\}\cup\{\cos(nx)\mid n \in \mathbb{N}\}\cup\{\sin(nx)\mid n\in\mathbb{N}\}$ forms a basis for the space you're interested in; it's $L^2[-\pi, \pi]$, but I won't explain what that means. Note, a lot of care needs to be taken here as the space is infinite dimensional; in particular, the definition of basis is not clear. As $B$ is a basis, we can write any element of $L^2[-\pi, \pi]$ as a linear combination of the elements in $B$. Furthermore, the space $L^2[-\pi, \pi]$ has an inner product. With respect to this inner product, the elements of $B$, up to a constant factor, form an orthonormal basis for $L^2[-\pi, \pi]$. This allows us to write out explicitly the coefficients of the basis vectors in the linear combination (this result is true in finite and infinite dimensional vector spaces, see here); these are precisely the formulae you have for $a_n$ and $b_n$.
Note, some of what I've said is not strictly true, but the ideas roughly match up with the theory. Further details can be found on Wikipedia.
A: One engaging but slightly misleading argument in favor of such expansions is to consider the Laplacian $d^2/dx^2$ and its $2\pi$-periodic eigenfunctions (the relevant exponentials, or, equivalently, sines and cosines), and imagine that every $2\pi$-periodic functions should be expressible as (infinite) linear combinations of eigenfunctions. The "expressible as" is part of the issue, since we need infinite sums, so convergence issues arise... In fact, square-integrability is sufficient for square-integrable (once called "mean-square") convergence, but definitely not for pointwise. (Cantor invented set theory while trying to understand pointwise convergence of Fourier series.) 
The cautionary point is that, in general, there need be no basis of eigenfunctions for "self-adjoint" (oop, and this notion needs precisification, too!) operators! The Laplacian on the real line already illustrates this perhaps-shocking situation, where Fourier inversion expresses functions as superpositions [sic!] of non-$L^2$ functions, the exponentials $e^{i\xi x}$.
Nevertheless, an 
