Why $\sum_{k=1}^m \left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2}$ converges to $\sum_{k=1}^\infty e^{-2\pi^2k^2}$? While I was considering random walk on $S^1$, I needed to compute the following.
$$\lim_{m\rightarrow\infty}\sum_{k=1}^m \left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2}$$
I guessed it should converges to trace of heat kernel on $S^1$. So I tried to use Mathematica. Mathematica says, it converges to following series:
$$\sum_{k=1}^\infty e^{-2\pi^2k^2}$$
But how can we prove this is true?
of course, proving
$$\lim_{m\rightarrow\infty}\left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2}=e^{-2\pi^2k^2}$$
is easy for each fixed $k$ (one can apply l'hospital rule or use taylor expansion).
But I don't know how to show
$$\lim_{m\rightarrow\infty}\sum_{k=1}^m \left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2}=\sum_{k=1}^\infty e^{-2\pi^2k^2}$$.
-Generalized version of above question is the following one: suppose a doubly indexed sequence $\{a_{mk}\}_{m\in\mathbb{N},1\leq k\leq m}$ and a sequence $\{b_k\}_{k=1}^\infty$ satisfy following two conditions:
(1) $\lim_{m\rightarrow\infty}a_{mk}=b_k$ for each positive integer $k$.
(2) $\sum_{k=1}^\infty b_k$ converges.
Then, can we conclude $\lim_{m\rightarrow\infty}\sum_{k=1}^m a_{mk}=\sum_{k=1}^\infty b_k$? In general it is not true (consider $a_{mk}=b_k+m^{-1/2}$). To make the limit true, what kinds of additional assumptions do we need? Maybe there is some known result about this general question?
 A: A sketch:
By exploiting symmetry of the sum, we can rewrite it as
$$
\begin{align}
&\sum_{k=1}^m \left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2} \\
&\qquad = \sum_{k=1}^{m/2} \left(\cos{\frac{\pi 2k}{2m+1}}\right)^{(2m+1)^2} - \sum_{k=1}^{m/2} \left(\cos{\frac{\pi (2k-1)}{2m+1}}\right)^{(2m+1)^2}, \tag{$*$}
\end{align}
$$
assuming $m$ is even. For fixed $k$ we have
$$
\lim_{m \to \infty} \left(\cos{\frac{\pi 2k}{2m+1}}\right)^{(2m+1)^2} = e^{-(\pi 2k)^2/2}
$$
and
$$
\lim_{m \to \infty} \left(\cos{\frac{\pi(2k-1)}{2m+1}}\right)^{(2m+1)^2} = e^{-(\pi(2k-1))^2/2}.
$$
Then, applying the dominated convergence theorem to each sum in $(*)$ using the domination relationships
$$
\left(\cos{\frac{\pi 2k}{2m+1}}\right)^{(2m+1)^2} \leq e^{-(\pi 2k)^2/2}
$$
and
$$
\left(\cos{\frac{\pi(2k-1)}{2m+1}}\right)^{(2m+1)^2} \leq e^{-(\pi(2k-1))^2/2}
$$
yields
$$
\begin{align}
\lim_{m \to \infty} \sum_{k=1}^m \left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2} &= \sum_{k=1}^{\infty} \left(e^{-(\pi 2k)^2/2} - e^{-(\pi(2k-1))^2/2}\right) \\
&= \sum_{k=1}^{\infty} (-1)^k e^{-(\pi k)^2/2}.
\end{align}
$$
Mathematica can evaluate this sum in terms of elliptic functions, and its numerical value is
$$
\sum_{k=1}^{\infty} (-1)^k e^{-(\pi k)^2/2} \doteq -0.00719\ 18806\ 80538\ 37459.
$$
In comparison, the Mathematica command
m=200;Sum[Cos[2 Pi k/(2 m+1)]^((2 m+1)^2),{k,1,m}]//N

returns the numerical approximation of the original sum when $m = 200$
$$
\left. \sum_{k=1}^m \left(\cos{\frac{2\pi k}{2m+1}}\right)^{(2m+1)^2} \right|_{m = 200} \doteq -0.00719\ 152.
$$
A: In response to the general case:

Claim:
If $|f_m(k)|\le g(x)$ where $g$ is an integrable function, and $\lim_{m\to\infty}f_m(x)=f(x)$ then $$\lim_{m\to\infty}\sum^m_{k=1}f_m(k)=\sum^\infty_{k=1}f(k)$$

Proof:
Define a ‘step function’:
$$
H_t(x)=
\begin{cases}
1, & x\le t\\
0, & x>t
\end{cases}
$$
Then,
$$S(m):=\sum^m_{k=1}f_m(k)=\sum^\infty_{k=1}f_m(x)H_m(x)$$
Let $\mu$ be the counting measure on $\mathbb N$.
Then, $$S(m)=\int f_m(x)H_m(x) d\mu$$
Since $|f_m(x)H_m(x)|\le |f_m(x)|\le g(x)$, by dominated convergence theorem,
$$\lim_{m\to\infty}S(m)=\int\lim_{m\to\infty}f_m(x)H_m(x)d\mu=\int f(x) d\mu=\sum^\infty_{k=1}f(k)$$
Q.E.D.

