There are two kind of terms in series $\displaystyle \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^2}$: terms with sign $+$ and terms with sign $-$. Note that:
$$\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^2}=\frac{1}{1^2}-\frac{1}{2^2}+\frac{1}{3^2}-\frac{1}{4^2}+\cdots$$
So $+$ occurs with terms for odd $n$ and $-$: for even terms. So let's divide this sum into two sums: for even and odd $n$:
$$\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^2}=\sum_{n=1 \text{n is odd}}^{\infty} \frac{(-1)^{n+1}}{n^2}+\sum_{n=1 \text{n is even}}^{\infty} \frac{(-1)^{n+1}}{n^2}$$
You know that $-$ occurs for odd $n$ and $+$ for even, so you can write down this equality in different way:
$$\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^2}=-\sum_{n=1 \text{n is odd}}^{\infty} \frac{1}{n^2}+\sum_{n=1 \text{n is even}}^{\infty} \frac{1}{n^2}$$
Next you can write down $\sum_{n=1 \text{n is even}}^{\infty} \frac{1}{n^2}$ in different way:
$$\sum_{n=1 \text{n is even}}^{\infty} \frac{1}{n^2}=\sum_{n=1}^{\infty} \frac{1}{(2n)^2}=\frac{1}{4}\sum_{n=1}^{\infty} \frac{1}{n^2}=\frac{\pi^2}{24}$$
On the other hand:
$$\sum_{n=1 \text{n is odd}}^{\infty} \frac{1}{n^2}=\sum_{n=1}^{\infty} \frac{1}{n^2}-\sum_{n=1 \text{n is even}}^{\infty} \frac{1}{n^2}=\frac{\pi^2}{6}-\frac{1}{4}\sum_{n=1}^{\infty} \frac{1}{n^2}=\frac{\pi^2}{6}-\frac{\pi^2}{24}$$