Show that $\int_{0}^{\infty}{x\over (1+x^2)^2}\cdot{\mathrm dx\over \tanh\left({\pi x\over 2}\right)}={\pi^2\over 8}-{1\over 2}?$

Exploiting the evenness of the integrand, we can write

$$\int_0^\infty \frac{x}{(1+x^2)^2\,\tanh\left(\frac{\pi x}{2}\right)}\,dx=\frac12\int_{-\infty}^\infty \frac{x}{(1+x^2)^2\,\tanh\left(\frac{\pi x}{2}\right)}\,dx \tag1$$

We can use contour integration to evaluate the integral on the right-hand side of $(1)$. The function $\frac{z}{(1+z^2)^2\,\tanh\left(\frac{\pi z}{2}\right)}$ has simple poles at $z=i2n$ for $n\in \mathbb{Z}\setminus{0}$ and second order poles at $z=\pm i$. Furthermore, we see that

$$\lim_{R\to \infty}\int_0^\pi \frac{Re^{i\phi}}{((Re^{i\phi})^2+1)^2\,\tanh\left(\frac{\pi Re^{i\phi}}{2}\right)}\,iRe^{i\phi}\,d\phi=0$$

Therefore, closing the contour in the upper-half plane and invoking the residue theorem yields

$$\begin{align} \frac12\int_{-\infty}^\infty \frac{x}{(1+x^2)^2\,\tanh\left(\frac{\pi x}{2}\right)}\,dx&=\pi i \sum_{n=1}^\infty \text{Res}\left(\frac{z}{(1+z^2)^2\,\tanh\left(\frac{\pi z}{2}\right)},z=i2n\right)\\\\&+\pi i \text{Res}\left(\frac{z}{(1+z^2)^2\,\tanh\left(\frac{\pi z}{2}\right)},z=i\right)\\\\ &=\pi i \sum_{n=1}^\infty\frac{i4n}{\pi(4n^2-1)^2}+\pi i \left(\frac{-i\pi}{8}\right)\\\\ &=-\frac12 +\frac{\pi^2}{8} \end{align}$$

as was to be shown!


To evaluate the series $\sum_{n=1}^\infty\frac{4n}{(4n^2-1)^2}$ we note that we can write the series as a telescoping series and find

$$\sum_{n=1}^\infty\frac{4n}{(4n^2-1)^2}=\frac12\sum_{n=1}^\infty \left(\frac{1}{(2n-1)^2}-\frac{1}{(2n+1)^2}\right)=\frac12$$


Another approach is to use the partial fraction expansion of $\coth(z)$. (See THIS QUESTION for derivations.)

$$\begin{align} & \int_{0}^{\infty} \frac{x}{(1+x^{2})^{2}} \coth \left(\frac{\pi x}{2} \right) \, dx \\ &= \int_{0}^{\infty} \frac{x}{(1+x^{2})^{2}} \left(\frac{2}{\pi x} + \pi x \sum_{n=1}^{\infty} \frac{1}{\frac{\pi^{2}x^{2}}{4}+ n^{2}\pi^{2}} \right) \, dx \\ &= \frac{2}{\pi} \int_{0}^{\infty} \frac{1}{(1+x^{2})^{2}}\, dx+ \frac{4}{\pi}\sum_{n=1}^{\infty}\int_{0}^{\infty}\frac{x^{2}}{(1+x^{2})^{2}(x^{2}+ 4n^{2})} \, dx \\ &= \frac{2}{\pi} \int_{0}^{\pi/2} \cos^{2}(u) \, du \\&+ \small \frac{4}{\pi} \sum_{n=0}^{\infty}\left(\frac{4n^{2}}{(4n^{2}-1)^{2}}\int_{0}^{\infty} \frac{1}{1+x^{2}} \, dx- \frac{1}{4n^{2}-1} \int_{0}^{\infty} \frac{1}{(1+x^{2})^{2}} \, dx - \frac{4n^{2}}{(4n^{2}-1)^{2}} \int_{0}^{\infty} \frac{1}{x^{2}+4n^{2}} \, dx\right) \\ &= \frac{2}{\pi} \left(\frac{\pi}{4}\right) + \frac{4}{\pi} \sum_{n=1}^{\infty} \left(\frac{4n^{2}}{(4n^{2}-1)^{2}}\frac{\pi}{2} - \frac{1}{4n^{2}-1}\frac{\pi}{4}- \frac{4n^{2}}{(4n^{2}-1)^{2}} \frac{\pi}{4n} \right) \\ &= \frac{1}{2} + \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{\pi}{4} \frac{1}{(2n+1)^{2}} \\ &= \frac{1}{2} + \left(\sum_{n=1}^{\infty}\frac{1}{n^{2}} - \sum_{n=1}^{\infty} \frac{1}{(2n)^{2}}-1 \right) \\ &= \frac{1}{2} + \left(\frac{\pi^{2}}{6} - \frac{1}{4} \frac{\pi^{2}}{6}-1 \right) \\ &=\frac{\pi^{2}}{8}-\frac{1}{2} \end{align}$$


$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\int_{0}^{\infty}{x \over \pars{1 + x^{2}}^{2}}\,{\dd x\over \tanh\pars{\pi x/2}} = {\phantom{^{2}}\pi^2\over 8} - {1 \over 2}:\ {\large ?}}$.

\begin{align} &\mbox{Note that}\quad {1 \over \tanh\pars{\pi x/2}} = {\expo{\pi x} + 1 \over \expo{\pi x} - 1} = 1 + {2 \over \expo{\pi x} - 1} \end{align} such that \begin{align} &\int_{0}^{\infty}{x \over \pars{1 + x^{2}}^{2}}\, {\dd x\over \tanh\pars{\pi x/2}} = \overbrace{\int_{0}^{\infty}{x \over \pars{1 + x^{2}}^{2}}\,\dd x} ^{\ds{1 \over 2}}\ +\ 2\ \overbrace{\int_{0}^{\infty}{x \over \pars{1 + x^{2}}^{2}} \,{1 \over \expo{\pi x} - 1}\,\dd x}^{\ds{\mbox{Set}\quad x/2\ \mapsto\ x}} \\[5mm] & = {1 \over 2} + {1 \over 2}\int_{0}^{\infty}{x \over \bracks{x^{2} + \pars{1/2}^{2}}^{2}} \,{1 \over \expo{2\pi x} - 1}\,\dd x = {1 \over 2} - \left.{1 \over 2}\,\partiald{}{z} \int_{0}^{\infty}{x \over x^{2} + z^{2}} \,{1 \over \expo{2\pi x} - 1}\,\dd x\,\right\vert_{\ z\ =\ 1/2} \end{align}

With Binet Second Formula ( see $\ds{\mathbf{\color{#000}{6.3.21}}}$ in A & S Table ),

\begin{align} &\int_{0}^{\infty}{x \over \pars{1 + x^{2}}^{2}}\, {\dd x\over \tanh\pars{\pi x/2}} = {1 \over 2} - {1 \over 2}\,\partiald{}{z}\bracks{\ln\pars{z} - 1/\pars{2z} - \Psi\pars{z} \over 2}_{\ z\ =\ 1/2} \\[5mm] = &\ {1 \over 2} - {1 \over 2}\bracks{2 - {1 \over 2}\,\Psi\,'\pars{1 \over 2}} = {1 \over 4}\,\Psi\,'\pars{1 \over 2} - {1 \over 2} = \bbx{{\phantom{^{2}}\pi^{2} \over 8} - {1 \over 2}} \end{align}

Note that $\ds{\Psi\,'\pars{1/2} = 3\pars{\pi^{2}/6} = \pi^{2}/2}$ ( see $\ds{\mathbf{6.4.4}}$ in A & S Table ).