Expand $\cos(x)$ in odd Fourier series. 
Expand $\cos(x)$ in sinus-series in the interval $(0,\pi/2)$ and use
  the result to calculate $$\sum_{n=1}^{\infty}\frac{n^2}{(4n^2-1)^2}.$$

Since we only need the odd terms in the Fourier expansion, we know that $a_n=0$, so we only need $b_n$ in order to find the sine expansion.
In my book, there is a chapter on "Fourier series on intervals", and there they state that: 

If $f$ is a piecewise smooth function on $[0,l]$, then the Fourier sine expansion is given by
$$f(x)=\sum_{n=1}^{\infty}b_n\sin\left(\frac{\pi n x}{l}\right),\tag{1}$$
where
$$b_n=\frac{2}{l}\int\limits_{0}^{l}f(x)\sin\left(\frac{\pi n x}{l}\right).\tag{2}$$

So we should be able to use only $(1)$ and $(2)$ with $l=\pi/2$ to solve this problem. So
\begin{align}
b_n=\frac{4}{\pi}\int\limits_{0}^{\pi/2}\cos(x)\sin(2nx)dx = \frac{4(\sin(\pi n)-2n)}{\pi(1-4n^2)}\tag{3}.
\end{align}
This gives
$$\cos(x)=\frac{8}{\pi}\sum_{n=1}^{\infty}\frac{n}{4n^2-1}\sin(2nx), \quad \forall \ n\in\mathbb{N}\tag{4}$$
2 questions remain:


*

*I used wolfram alpha to calculate the integral in $(3)$. What methods do I use to do this? Repeated integration by parts and solve for the integral?

*How do I calculate the desired sum?

 A: As posted by the OP, two steps remain:


*

*Perform the integral:


$$
b_n=\frac{4}{\pi}\int\limits_{0}^{\pi/2}\cos(x)\sin(2nx)dx \\
= \frac{1}{i \pi}\int\limits_{0}^{\pi/2}e^{ix(1+2n)}- e^{ix(1-2n)}+e^{-ix(1-2n)}-e^{-ix(1+2n)}dx \\
= \frac{1}{i \pi} \left(\frac{e^{ix(1+2n)}}{i(1+2n)}|_{0}^{\pi/2} - \frac{e^{ix(1-2n)}}{i(1-2n)}|_{0}^{\pi/2} + \frac{e^{-ix(1-2n)}}{-i(1-2n)}|_{0}^{\pi/2} -\frac{e^{-ix(1+2n)}}{-i(1+2n)}|_{0}^{\pi/2} \right)\\
= \frac{1}{i \pi} \left(\frac{i(-1)^n - 1}{i(1+2n)} - \frac{i(-1)^n - 1}{i(1-2n)} + \frac{-i(-1)^n - 1}{-i(1-2n)} - \frac{-i(-1)^n - 1}{-i(1+2n)} \right)\\
= \frac{1}{- \pi (1 - 4 n^2)} \left( -4n(i(-1)^n - 1) - 4n (-i(-1)^n - 1)  \right)\\
= \frac{-8n}{\pi(1-4n^2)} \\
= \frac{4(\sin(\pi n)-2n)}{\pi(1-4n^2)}
$$
where the last step only indicates the "desired" solution by WolframAlpha, where anyway $\sin(\pi n) = 0$ .
2 Calculating the desired sum.
From OP's last result,
$$
\cos(x)=\frac{8}{\pi}\sum_{n=1}^{\infty}\frac{n}{4n^2-1}\sin(2nx),
$$
 multiply this formula with $\cos(x) $ and integrate, using the integral which was just derived:
$$
\frac{\pi}{4} = \int\limits_{0}^{\pi/2}\cos^2(x) dx = \frac{8}{\pi} \sum_{n=1}^\infty \frac{n}{4n^2 -1} \int\limits_{0}^{\pi/2}\cos(x)\cdot\sin(2nx) dx = \\
\frac{8}{\pi} \sum_{n=1}^\infty \frac{n}{4n^2 -1} \cdot \frac{2 n}{4n^2 -1}\\ 
= \frac{16}{\pi} \sum_{n=1}^\infty \frac{n^2}{(4n^2 -1)^2}  
$$
so finally
$$
\sum_{n=1}^\infty \frac{n^2}{(4n^2 -1)^2} = \frac{\pi^2}{64} 
$$
A: Consider the function $f(x) = \cos(x) \cdot {\rm{sign}}(x)$ in the interval $(-\pi, \pi)$. This function is identical to $\cos(x)$ in the interval $(0, \pi/2)$ so the expansion will be correct in that interval.
You want $f(x) = \sum_{m=1}^\infty b_m \sin(mx)$.
Integrating with $\sin(nx)$ gives 
$$
\int\limits_{-\pi}^{\pi}\sin( n x)\sin(nx)dx = \pi
$$
$$
 \int\limits_{-\pi}^{\pi}\sin( m x)\sin(nx)dx = 0 \quad (m\ne n)
$$
and
$$
\int\limits_{-\pi}^{\pi}\cos(x)\cdot {\rm{sign}}(x) \cdot \sin(nx)dx = 2 \int\limits_{0}^{\pi}\cos(x)\cdot \sin(nx)dx =  2 \frac{n (1+\cos(\pi n))}{n^2 - 1} \tag{*}
$$
So you have 
$$
\cos(x) = \frac{2}{\pi} \sum_{n=1}^\infty \frac{n (1+\cos(\pi n))}{n^2 - 1} \sin(nx)
$$
where the coefficients are nonzero for even n.
Substituting $n$  with $2 m$ gives
$$
\cos(x) = \frac{8}{\pi} \sum_{m=1}^\infty \frac{m}{4m^2 -1} \sin(2 m x)
$$
No use the integral in (*) again: multiply the last formula with $\cos(x) $ and integrate:
$$
\frac{\pi}{2} = \int\limits_{0}^{\pi}\cos^2(x) dx = \frac{8}{\pi} \sum_{m=1}^\infty \frac{m}{4m^2 -1} \int\limits_{0}^{\pi}\cos(x)\cdot\sin(2mx) dx = \frac{32}{\pi} \sum_{m=1}^\infty \frac{m^2}{(4m^2 -1)^2} 
$$
so finally
$$
\sum_{m=1}^\infty \frac{m^2}{(4m^2 -1)^2} = \frac{\pi^2}{64} 
$$
