$$\int_{(2n-1)\pi}^{(2n+1)\pi}\left|x-2n\pi\right|\cos(k x)\mathrm dx$$ where $k\geq 0$, $k\in\mathbb{N} $ and $n\in\mathbb{R} $.
it is a $a_k$ coefficient in a Fourier series.
$$\int_{(2n-1)\pi}^{(2n+1)\pi}\left|x-2n\pi\right|\cos(k x)\mathrm dx$$ where $k\geq 0$, $k\in\mathbb{N} $ and $n\in\mathbb{R} $.
it is a $a_k$ coefficient in a Fourier series.
On
Here is the final answer by maple
$$ 2\,{\frac {2\, \left( -1 \right) ^{k} \left( \cos \left( \pi \,kn \right) \right) ^{2}-2\, \left( \cos \left( \pi \,kn \right) \right) ^{2}+ \left( -1 \right) ^{k+1}+1}{{k}^{2}}} . $$
Added: More simplification leads to the more compact form
$$ 2\,{\frac {\cos \left( 2\,\pi \,kn \right) \left( \left( -1 \right) ^{k}-1 \right) }{{k}^{2}}}.$$
On
Changing the variable as Mercy did $x-2n\pi=t$ $$\int_{(2n-1)\pi}^{(2n+1)\pi}\left|x-2n\pi\right|\cos(k x)\mathrm dx=\int_{-\pi}^{\pi}|t| \cos(kt+2kn\pi)\,dt$$ Then expanding cosine one can obtain: $$\cos(2kn\pi)\int_{-\pi}^{\pi}|t|\cos(kt)\,dt-\sin(2kn\pi)\int_{-\pi}^{\pi}|t|\sin(kt)\,dt$$ Noting that $|t|\cos(kt)$ is even and $|t|\sin(kt)$ is odd and using the fact that on a symmetric interval the integral of the odd function is zero and the integral of the even function is equal to the doubled integral on the halved interval one can get: $$\int_{-\pi}^{\pi}|t| \cos(kt+2kn\pi)\,dt=2\cos(2kn\pi)\int_{0}^{\pi}t\cos(kt)\,dt=\frac{2 \left((-1)^k-1\right) (\cos (2 \pi k n))}{k^2}$$
\begin{eqnarray} a_k&=&\int_{(2n-1)\pi}^{(2n+1)\pi}|x-2n\pi|\cos(kx)\,dx=\int_{-\pi}^{\pi}|x|\cos(kx+2kn\pi)\,dx\\ &=&\int_{-\pi}^\pi|x|\left[\cos(2kn\pi)\cos(kx)-\sin(2knx)\sin(kx)\right]\,dx\\ &=&\int_{-\pi}^\pi|x|\cos(2kn\pi)\cos(kx)\,dx=2\cos(2kn\pi)\int_0^\pi x\cos(kx)\,dx\\ &=&\frac{2\cos(2kn\pi)x\sin(kx)}{k}\Big|_0^\pi-\frac{2\cos(2kn\pi)}{k}\int_0^\pi\sin(kx)\,dx\\ &=&\frac{2\cos(2kn\pi)}{k^2}\cos(kx)\Big|_0^\pi=2\frac{(-1)^k-1}{k^2}\cos(2kn\pi). \end{eqnarray}
NB: When I first answered the question I did not notice the condition $n \in \mathbb{R}$ and just assumed that $n \in \mathbb{Z}$.