I am having some problem on my arguments and I want to see where it fails. It deals with pointwise convergence in $L^2[-\pi,\pi]$: pointwise convergence is given by Carleson's Theorem (so it is a hard result!) so my following argument must be wrong.
First, pick your function $f\in L^2[-\pi,\pi]$, and consider $B=\{g_k\}_{k\geq 0}$ to be the family or orthogonal functions $\frac{1}{\sqrt{2\pi}}, \frac{1}{\sqrt{\pi}}\cos(nx)$ and the corresponding normalized sinus term. We know that $B$ is complete, namely if $(f,g)=0$ for all $g\in B$, then necessarily $f$ is equal to $0$ (almost everywhere).
We also know (by Riesz-Fischer theorem) that $L^2$ is a complete space, so for any sequence $\{c_k\}_{k\geq 0}$ with $\sum_{k\geq 0} c_k^2< \infty$, the function
$$\bar{f}=\sum_{k\geq 0}c_k g_k$$
is inside $L^2$, and working just a little we see that for each $k$, $(\bar{f},g_k)$ is precisely $c_k$.
So, now, let us take $f$ with Fourier coefficients $c_k=(f,g_k)$, which, by Bessel, satisfies that $\sum_{k\geq 0} c_k^2 <\infty$. With these coefficients we can define the corresponding function $\bar{f}$.
Then, here it comes the crutial argument where I get lost/probably doing a mistake: as for every $k$ we have that $(f,g_k)=(\bar{f},g_k)=c_k$, then $(f-\bar{f},g_k)=0$. As $B$ is a complete family, this means that necessarily $f=\bar{f}$ almost everywhere.
But this is telling us precisely that the Fourier series of $f$ convergences pointwise almost everywhere to $f$, which is the content of Carleson's Theorem.
So, what I am doing wrong?
The sum $\sum_{k\geq 0}c_kg_k$ is convergent in $L^2$. A priori we have no reason to believe its $L^2$ limit is also its pointwise limit. Indeed, there exist convergent sequences in $L^2$ which are not pointwise convergent at any point.
Carleson's theorem in essense says that if you have a sequence of this special form, given by some linear combination of orthonormal basis, is going to be pointwise convergent almost everywhere to its $L^2$ limit.
Here is an example of a sequence as mentioned above: for each $n\in\mathbb N$ and $0\leq k<n$ let $f_{n,k}=\chi_{[k/n,(k+1)/n]}$. Then the sequence $$f_{1,1},f_{2,1},f_{2,2},f_{3,1},f_{3,2},f_{3,3},f_{4,1},\dots$$ converges to $0$ in $L^2$ (since the $L^2$ norm of $f_{n,k}$ is $1/\sqrt{n}$), but this sequence is not pointwise convergent anywhere.