How to evaluate $\sum_{n=1}^\infty \frac{n^5}{e^{2\pi n}-1}$? I recently found the following result on Twitter.
$$\sum_{n=1}^\infty \frac{n^5}{e^{2\pi n}-1}=\frac{1}{504}$$
I know that $\int_0^\infty \frac{x^5}{e^{2 \pi x}-1} dx = \frac{5!}{(2\pi)^6}\zeta(6)=\frac{1}{504}$
How to show that the sum is also equal to the same number?
Can this be generalized to a class of functions where the sum (over positive integers) and the definite integral (from 0 to $\infty$) are the same?

I'm not sure if it's more appropriate to post this here or elsewhere, but we can integrate the function $$f(z) = \frac{z^{5}e^{iz}}{\cosh(z) - \cos(z)} $$ around the contour $$\left[-\frac{(2N+1) \pi \sqrt{2}}{2}, \frac{(2N+1) \pi \sqrt{2}}{2}\right] \cup \frac{(2N+1) \pi \sqrt{2}}{2} e^{i[0, \pi]}.  $$
(For any positive integer $N$, the semicircular part of the above contour passes halfway between two adjacent poles of $f(z)$.)
As $N \to \infty$ through the positive integers, the magnitude of $f(z)$ decays exponentially to zero on the semicircle.  This is due to the fact that the magnitude of $e^{iz}$ decays exponentially to zero as $\Im(z) \to + \infty$, while the magnitude of $\cosh(z)$ grows exponentially as $\Re(z) \to \pm \infty$.
We therefore have $$\begin{align} \int_{-\infty}^{\infty} f(x) \, \mathrm dx &= 2 \pi i \left(\sum_{n=1}^{\infty}\operatorname{Res}\left[f(z), n \pi(1+i) \right]+ \sum_{n=1}^{\infty}\operatorname{Res}\left[f(z), n \pi(-1+i) \right] \right) \\ &= 2 \pi i \left(\sum_{n=1}^{\infty}\lim_{z \to n\pi(1+i)} \frac{z^{5}e^{iz}}{\sinh(z) + \sin (z)} + \sum_{n=1}^{\infty} \lim_{z \to n \pi(-1+i)} \frac{z^{5}e^{iz}}{\sinh(z) + \sin (z)} \right) \\&= 2 \pi i \left(\sum_{n=1}^{\infty} \frac{n^{5} \pi^{5}(1+i)^{5}(-1)^{n} e^{- n \pi}}{(-1)^{n}(1+i)\sinh(n \pi)} + \sum_{n=1}^{\infty} \frac{n^{5} \pi^{5}(-1+i)^{5}(-1)^{n}e^{-n \pi}}{(-1)^{n}(-1+i) \sinh(n \pi)} \right) \\ &= -16 \pi^{6} i \sum_{n=1}^{\infty} \frac{n^{5}e^{-n \pi}}{\sinh(n \pi)} \\ &=-32 \pi^{6} i \sum_{n=1}^{\infty} \frac{n^{5}}{e^{2 \pi n}-1}. \end{align} $$
Equating the imaginary parts on both sides of the equation, we get $$ \begin{align} \sum_{n=1}^{\infty} \frac{n^{5}}{e^{2 \pi n}-1} &= -\frac{1}{32 \pi^{6}} \int_{-\infty}^{\infty} \frac{x^{5} \sin(x)}{\cosh(x) - \cos(x)} \, \mathrm dx \\ &= -\frac{1}{16 \pi^{6}} \int_{0}^{\infty}\frac{x^{5} \sin(x)}{\cosh(x) - \cos(x)} \, \mathrm dx \\ &=  -\frac{1}{8 \pi^{6}} \, \Im \int_{0}^{\infty}x^{5} \sum_{n=1}^{\infty}  e^{-(1-i)nx} \, \mathrm dx \\ &= -\frac{1}{8 \pi^{6}} \, \Im  \sum_{n=1}^{\infty} \int_{0}^{\infty} x^{5} e^{-(1-i)nx} \, \mathrm dx \\ &= -\frac{1}{8 \pi^{6}} \, \Im \sum_{n=1}^{\infty} \frac{\Gamma(6)}{(1-i)^6n^{6}} \\ &= \frac{15}{8 \pi^{6}} \sum_{n=1}^{\infty} \frac{1}{n^{6}} \\ &= \frac{1}{504}. \end{align}$$
