Deriving formula from Fourier series: $\frac{\pi^2}{12} = \sum\limits_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^2}$
Solution 1:
We have that: $$ \sum_{n\geq 1}\frac{2(-1)^{n+1}}{n}\,\sin(nx) $$ is the Fourier series of the $2\pi$-periodic extension of $f(x)=x$, so, by termwise integration, $$\begin{eqnarray*} \forall x\in(-\pi,\pi),\qquad x^2&=&\sum_{n\geq 1}\frac{4(-1)^{n+1}}{n^2}\left(1-\cos(nx)\right)\\&=&\color{blue}{\left(\sum_{n\geq 1}\frac{4(-1)^{n+1}}{n^2}\right)}-\sum_{n\geq 1}\frac{4(-1)^{n+1}}{n^2}\cos(nx)\end{eqnarray*}$$ and it follows that the blue term is the mean value of the function $g(x)=x^2$ over the interval $(-\pi,\pi)$, so: $$\color{blue}{\sum_{n\geq 1}\frac{4(-1)^{n+1}}{n^2}}=\frac{1}{2\pi}\int_{-\pi}^{\pi}x^2\,dx = \color{blue}{\frac{\pi^2}{3}}$$ and
$$\sum_{n\geq 1}\frac{(-1)^{n+1}}{n^2}=\color{red}{\frac{\pi^2}{12}}$$
readily follows.
Solution 2:
This does not directly answer the question posed in the OP regarding the use of Fourier Series to prove that
$$\frac{\pi^2}{12}=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n^2} \tag 1$$
But, I thought it might be instructive to present an approach that relies only on the Basel Problem
$$\frac{\pi^2}{6}=\sum_{n=1}^\infty \frac{1}{n^2} \tag 2$$
which was proven by Euler without use of Fourier Series. To that end, we proceed.
Note that we can write the series in $(1)$ as
$$\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n^2}=\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}-\frac{1}{(2n)^2}\right) \tag 3$$
Alongside this result, we can write the series in $(2)$ as
$$\begin{align} \frac{\pi^2}{6}&=\sum_{n=1}^\infty \frac{1}{n^2} \\\\ &=\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}+\frac{1}{(2n)^2}\right) \\\\ &=\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}-\frac{1}{(2n)^2}\right)+2\sum_{n=1}^\infty\frac{1}{(2n)^2} \\\\ &=\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}-\frac{1}{(2n)^2}\right)+\frac12\sum_{n=1}^\infty\frac{1}{n^2} \\\\ &=\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}-\frac{1}{(2n)^2}\right)+\frac{\pi^2}{12}\\\\ \frac{\pi^2}{12}&=\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}-\frac{1}{(2n)^2}\right)\tag 4 \end{align}$$
Substituting $(4)$ into $(3)$ yields the coveted result.