To clarify your confusion:
Weierstrass M-test states one and only one thing:
Given a sequence of functions $f_k(x)$ defined on $E\subseteq\mathbb{R}$, the series $\sum f_k(x)$ converges uniformly if there exists a sequnece of reals $M_k$ such that $|f_k|\le M_k$ for each $k$ and $\sum M_k$ converges.
Note here that $M_k$ must not depend on $x$. This only means that if you found such sequence $M_k$ then the series uniformly converges. It says nothing about the series if you have found some $M_k$ whose series does not converge.
In particular, this test cannot be used to prove that some series does not converge uniformly.
Now consider
$$
f_k(x)=\frac{1}{kx+2}-\frac{1}{(k+1)x+2}
$$
Consider the partial sum
\begin{align*}
S_n(x)=\sum_{k=0}^{n} f_k(x)&=\left(\frac{1}{2}-\frac{1}{x+2}\right)+\cdots+\left(\frac{1}{nx+2}-\frac{1}{(n+1)x+2}\right)\\
&=\frac{1}{2}-\frac{1}{(n+1)x+2}
\end{align*}
the series $\sum f_k(x)$ converges uniformly if and only if $S_n$ converges uniformly.
Now $S_n(0)=0$ for all $n$. So $S_n(0) \to 0$, and $S_n(x) \to \frac{1}{2}$ for $0<x\le 1$. So define
$$
S(x)=
\begin{cases}
0 & \text{if} \quad x=0 \\
\frac{1}{2} & \text{if} \quad 0<x\le 1
\end{cases}
$$
Then $S_n(x)\to S(x)$. Also, $S_n(0)-S(0)=0$ for any $n$. Now
$$
m_n:=\sup_{x\in [0,1]} |S_n-S|=\sup_{x\in (0,1]} \left\lvert -\frac{1}{(n+1)x+2} \right\rvert=\frac{1}{2} \not\to 0
$$
So $S_n$ does not converge uniformly.
You have to prove that your upper bound is valid. Use the fact that $e^{x} \geq x$ for $x >0$ (which follows from the Taylor expansion). Now $e^{n^{2}x^{2}} \geq e^{n^{2}a^{2}} \geq n^{2}a^{2}$ so $\frac 1 {e^{n^{2}x^{2}}} \leq \frac 1 {n^{2}a^{2}}$, now compare with the series $ \sum \frac 1 {n^{2}a^{2}}$ which is convergent.
Best Answer
Substituting $x=0$ for the function and it's fourier expansion we get:
$$0 = \frac{\pi}{2} + \frac{2}{\pi}\sum_{n=1}^{\infty}\frac{(-1)^n-1}{n^2}$$
Since $cos(0)=1$.
Now, notice that the term $(-1)^n-1$ will be zero whenever $n$ is odd, and will be $-2$ if $n$ is even. Therefore we can ignore the even terms and subtitute $n=2k+1$ summing over $k$, going from zero to infinity.
$$0 = \frac{\pi}{2} + \frac{2}{\pi}\sum_{k=0}^{\infty}\frac{-2}{(2k+1)^2}$$
Rearranging terms:
$$0 = \frac{\pi}{2} - \frac{4}{\pi}\sum_{k=0}^{\infty}\frac{1}{(2k+1)^2}$$
And finally:
$$\frac{\pi^2}{8} = \sum_{k=0}^{\infty}\frac{1}{(2k+1)^2}$$