Proving that $\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^{2}}=\frac{\pi^{2}}{12}$

$$\sum_{n=1}^{\infty}\frac{(-1)^{n}\cos(n\theta)}{n^{2}}=\frac{\theta^{2}}{4}-\frac{\pi^{2}}{12}$$

Take $\theta=0$ so $\cos n \theta = 1$

$$ \sum_{n=1}^{\infty}\frac{(-1)^{n}}{n^{2}}=-\frac{\pi^{2}}{12}\\ (-1)\sum_{n=1}^{\infty}\frac{(-1)^{n}}{n^{2}}=(-1)\cdot\left(-\frac{\pi^{2}}{12}\right)\\ \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^{2}}=\frac{\pi^{2}}{12}\\ $$


Split it! $$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^{2}}=\sum_{n ~\text{odd}}\frac{1}{n^{2}} - \sum_{n ~\text{even}}\frac{1}{n^{2}}.$$

Add and subtract the "even" part:

$$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^{2}}=\left(\sum_{n ~\text{odd}}\frac{1}{n^{2}} + \sum_{n ~\text{even}}\frac{1}{n^{2}}\right) - \sum_{n ~\text{even}}\frac{1}{n^{2}} - \sum_{n ~\text{even}}\frac{1}{n^{2}} = \\ =\sum_{n=1}^{\infty}\frac{1}{n^2}-2\sum_{n ~\text{even}}\frac{1}{n^{2}} = \frac{\pi^2}{6} - 2\sum_{n ~\text{even}}\frac{1}{n^{2}}.$$

Now, notice that:

$$\sum_{n ~\text{even}}\frac{1}{n^{2}}=\sum_{i =1}^{\infty}\frac{1}{(2i)^{2}} = \frac{1}{4}\sum_{i =1}^{\infty}\frac{1}{i^{2}} = \frac{1}{4}\frac{\pi^2}{6}.$$

Therefore:

$$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^{2}} = \frac{\pi^2}{6} - 2\frac{1}{4}\frac{\pi^2}{6} = \frac{\pi^2}{12}.$$