Exact result of a series using Euler-Maclaurin expansion. This is a variant of Exercise 64 in Chapter 9 of concrete mathematics. 
Prove the following identity
\begin{equation}
\sum_{n = -\infty}^{\infty}' \frac{1 - \cos( 2\pi n k )}{n^2 }  = 2 \pi^2 ( k - k^2 ) \qquad k \in [0,1]
\end{equation}
I came across it in a different context and was surprised that it is exact. 
Let's use Euler-Maclaurin expansion to convert the sum into an integral. 
Take $f(x) = \frac{1 - \cos( 2\pi x k )}{x^2 } $
\begin{equation}
\sum_{n = -N+1}^{N}' f(n) = \int_{-N}^{N} f(x) dx - f(0) + \sum_{k=1}^{p} \frac{B_k}{k!}f^{(k-1)}(x)\Big|^N_{-N} + R_p 
\end{equation}
The first two terms are already the exact result, 
\begin{equation}
\int_{-\infty}^{\infty} f(x) dx = 2\pi k \int_{-\infty}^{\infty} \frac{1- \cos x}{x^2}dx = 2\pi^2 k \qquad f(0) = 2\pi^2 k^2 
\end{equation}
so one needs to prove the end point corrections(terms with $B_k$ in it) as well as the reminder terms are zero. 
At any order $p$, there are only finite number of end point correction terms which goes at most like $\mathcal{O}(\frac{1}{N^2})$, so they vanish when taking the $N\rightarrow \infty$ limit. But I don't know how to show the reminder term is zero(as $N\rightarrow \infty$),
\begin{equation}
R_p(N)  = (-1)^p \int_{-N}^{N} \frac{1}{p!} B_p( x - \lfloor x \rfloor ) f^{(p)}(x) dx 
\end{equation}
Maybe there are other methods to prove the identity, but I personally would appreciate the proof using Euler Maclaurin, since I'm going to use it for another series, and the reminder term has
\begin{equation}
f(x) = \frac{g(x) - g(0) }{ x^2} - \frac{g'(0)}{x}
\end{equation}
where $g(x ) = g(x + N)$ is a periodic function. So you can also go ahead and prove the general $g(x)$ case.
Thanks.
Edit:
The general case can also be worked out by robjohn 's method by summing over each individual the Fourier components. Though a direct proof of the vanishing Euler-Maclaurin reminder term is still absent, robjohn's method solved my problem. 

The identity is equivalent to
$$\sum_{n\ge 1} \frac{1-\cos(2\pi nx)}{n^2} = \pi^2 x(1-x).$$
The sum term  $$S(x) = \sum_{n\ge 1} \frac{1-\cos(2\pi nx)}{n^2}$$
is harmonic and may be evaluated by inverting its Mellin transform.
Recall the harmonic sum identity
$$\mathfrak{M}\left(\sum_{k\ge 1} \lambda_k g(\mu_k x);s\right) =
\left(\sum_{k\ge 1} \frac{\lambda_k}{\mu_k^s} \right) g^*(s)$$
where $g^*(s)$ is the Mellin transform of $g(x).$
In the present case we have
$$\lambda_k = \frac{1}{k^2}, \quad \mu_k = k \quad \text{and} \quad
g(x) = 1-\cos(2\pi x).$$
We need the Mellin transform $g^*(s)$ of $g(x).$

Now the Mellin transform of $\cos(x)$ was computed at this 
MSE link 
and found to be $$\Gamma(s) \cos(\pi s/2)$$
and therefore
$$g^*(s) = -\frac{1}{(2\pi)^s} \Gamma(s) \cos(\pi s/2)$$
with fundamental strip $\langle -2, 0 \rangle$
(the constant one in $g(x)$ shifts the fundamental strip).

Hence the Mellin transform $Q(s)$ of $S(x)$ is given by
$$ Q(s) = -\frac{1}{(2\pi)^s} \Gamma(s) \cos(\pi s/2) \zeta(s+2)
\quad\text{because}\quad
\sum_{k\ge 1} \frac{\lambda_k}{\mu_k^s} = \zeta(s+2)$$
where $\Re(s+2) > 1$ or $\Re(s) > -1$.

Intersecting the  fundamental strip and  the half-plane from  the zeta
function  term we  find  that  the Mellin  inversion  integral for  an
expansion about zero is
$$\frac{1}{2\pi i} \int_{-1/2-i\infty}^{-1/2+i\infty} Q(s)/x^s ds$$
which we evaluate in the left half-plane $\Re(s)<-1/2.$
The cosine  term cancels the poles  of the gamma function  term at odd
negative  integers  and the  zeta  function  term  the poles  at  even
negative integers. We are left with just three poles.
$$\begin{align}
\mathrm{Res}(Q(s)/x^s; s=0) & = -\frac{\pi^2}{6} \\
\mathrm{Res}(Q(s)/x^s; s=-1) & = \pi^2 x \quad\text{and}\\
\mathrm{Res}(Q(s)/x^s; s=-2) & = -\pi^2 x^2.
\end{align}$$
The pole at $s=0$ is outside the left half-plane of evaluation.
Hence in a neighborhood of zero,
$$S(x) =  \pi^2 x(1-x)$$
as claimed.

To see that this is exact put  $s= \sigma + it$ with $\sigma \le -5/2$
where we seek to evaluate
$$\frac{1}{2\pi i} \int_{-5/2-i\infty}^{-5/2+i\infty} Q(s)/x^s ds.$$
Recall that with $\sigma > 1$ and for $|t|\to\infty$ we have
$$|\zeta(\sigma+it)| \in \mathcal{O}(1).$$

Furthermore recall the functional equation 
of the Riemann Zeta function
$$\zeta(1-s) = \frac{2}{2^s\pi^s} 
\cos\left(\frac{\pi s}{2}\right) \Gamma(s) \zeta(s)$$
which we re-parameterize like so
$$\zeta(s+2) = 2\times (2\pi)^{s+1}
\cos\left(-\frac{\pi (s+1)}{2}\right) \Gamma(-s-1) \zeta(-s-1)$$
which is
$$\zeta(s+2) = -2\times (2\pi)^{s+1}
\sin(\pi s/2) \frac{\Gamma(1-s)}{s(s+1)} \zeta(-s-1).$$
Substitute this into $Q(s)$ to obtain
$$\frac{1}{(2\pi)^s} \Gamma(s) \cos(\pi s/2) \times
2 \times (2\pi)^{s+1} \sin(\pi s/2) 
\frac{\Gamma(1-s)}{s(s+1)} \zeta(-s-1).$$
Use the reflection formula for the Gamma function to obtain
$$\frac{1}{(2\pi)^s}  \cos(\pi s/2) \times
2 \times (2\pi)^{s+1} \sin(\pi s/2) \times
\frac{\pi}{\sin(\pi s)}
\frac{1}{s(s+1)} \zeta(-s-1),$$
in other words we have
$$Q(s) = 2\pi^2 \frac{\zeta(-s-1)}{s(s+1)}.$$
This finally implies (with $\sigma< -5/2$ we have $\Re(-s-1) > 3/2$)
$$|Q(s)/x^s|\sim x^{-\sigma} |t|^{-2}.$$
We see from the term in $|t|$ that the integral obviously converges.
(This much we knew already.)
Moreover, when $x\in(0,1)$ we have $x^{-\sigma}\to 0$ as 
$\sigma\to -\infty.$ 
The term in $x$ does not depend on the variable $t$ of the integral and may be brought to the front.
This means that the contribution from the left side of the rectangular
contour that we employ as we  shift to the left vanishes in the limit,
proving the exactness of the formula for $S(x)$ obtained earlier.

There is a theorem hiding here, namely that certain Fourier series can
be  evaluated  by  inverting  their  Mellin transforms  which  is  not
terribly  surprising and  which the  reader  is invited  to state  and
prove.
