How to compute the integral $\int_0^\infty\frac{x}{e^x+1}dx$ using the Residue theorem.

How to compute the integral $\int_0^\infty\frac{x}{e^x+1}dx$ using the Residue theorem, just as the title says. I have used rectangles, circles to do, but without any progress.

By changing variable $y=e^x$, we get $\int_1^\infty \frac{\ln y}{y(y+1)}dy$. I still have no idea.

Solutions Collecting From Web of "How to compute the integral $\int_0^\infty\frac{x}{e^x+1}dx$ using the Residue theorem."

To use a rectangular contour, consider the integral

$$\oint_C dz \frac{z^2}{e^z+1}$$

where $C$ is the rectangular contour having vertices at $0$, $R$, $R+i 2 \pi$, and $i 2 \pi$, with a semicircular detour into the rectangle of radius $\epsilon$ at $z=i \pi$. The contour integral is then equal to

$$\int_0^R dx \frac{x^2}{e^x+1} + i \int_0^{2 \pi} dy \frac{(R+i y)^2}{e^{R+i y}+1} \\ + \int_R^0 dx \frac{(x+i 2 \pi)^2}{e^{x+i 2 \pi}+1} + i \int_{2 \pi}^{\pi+\epsilon} dy \frac{(i y)^2}{e^{i y}+1}\\ + i \epsilon \int_{\pi/2}^{-\pi/2} d\phi \, e^{i \phi} \frac{(i \pi+\epsilon e^{i \phi})^2}{e^{i \pi+\epsilon e^{i \phi}}+1}+i \int_{\pi-\epsilon}^0 dy \frac{(i y)^2}{e^{i y}+1}$$

We consider the limit as $R\to\infty$ and $\epsilon \to 0$. As $R\to\infty$, the second integral vanishes. As $\epsilon\to 0$, the fifth integral approaches

$$i \epsilon \int_{\pi/2}^{-\pi/2} d\phi \, e^{i \phi} \frac{-\pi^2}{-\epsilon e^{i \phi}}=-i \pi^3$$

By Cauchy’s theorem, the contour integral is zero. We then have, expanding the first and third integrals and combining the fourth and sixth integrals into a Cauchy principal value:

$$-i 4 \pi \int_0^{\infty} dx \frac{x}{e^x+1} +4 \pi^2 \int_0^{\infty} \frac{dx}{e^x+1}\\ +i \,PV \int_0^{2 \pi} dy \frac{y^2}{e^{i y}+1}-i \pi^3=0$$

where $PV$ denotes the Cauchy principal value. Note that

$$PV \int_0^{2 \pi} dy \frac{y^2}{e^{i y}+1} = \frac12 \int_0^{2 \pi} dy \: y^2 -i \frac12 \, PV \int_0^{2 \pi} dy \frac{y^2 \sin{y}}{1+\cos{y}}$$

Equating imaginary parts, we see that

$$-4 \pi \int_0^{\infty} dx \frac{x}{e^x+1} + \frac12 \frac{(2 \pi)^3}{3} – \pi^3=0$$

or

$$\int_0^{\infty} dx \frac{x}{e^x+1} = \frac13 \pi^2-\frac14\pi^2 = \frac{\pi^2}{12}$$

$\newcommand{\+}{^{\dagger}}%
\newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
\newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
\newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
\newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
\newcommand{\dd}{{\rm d}}%
\newcommand{\ds}[1]{\displaystyle{#1}}%
\newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
\newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
\newcommand{\fermi}{\,{\rm f}}%
\newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
\newcommand{\half}{{1 \over 2}}%
\newcommand{\ic}{{\rm i}}%
\newcommand{\iff}{\Longleftrightarrow}
\newcommand{\imp}{\Longrightarrow}%
\newcommand{\isdiv}{\,\left.\right\vert\,}%
\newcommand{\ket}[1]{\left\vert #1\right\rangle}%
\newcommand{\ol}[1]{\overline{#1}}%
\newcommand{\pars}[1]{\left( #1 \right)}%
\newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
\newcommand{\pp}{{\cal P}}%
\newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
\newcommand{\sech}{\,{\rm sech}}%
\newcommand{\sgn}{\,{\rm sgn}}%
\newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
\newcommand{\ul}[1]{\underline{#1}}%
\newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}
&? \equiv \int_{0}^{\infty}{x \over \expo{x} + 1}\,\dd x=
{1 \over 4}\int_{-\infty}^{\infty}
{x^{2}\expo{x} \over \pars{\expo{x} + 1}^{2}}\,\dd x
=
{1 \over 16}\int_{-\infty}^{\infty}{x^{2}\ \over \cosh^{2}\pars{x/2}}\,\dd x
=\half\int_{-\infty}^{\infty}{x^{2}\ \over \cosh^{2}\pars{x}}\,\dd x
\end{align}
Zeros of $\cosh\pars{x}$ are at $x_{n} = \pars{n + 1/2}\pi\ic$.
$n \in {\mathbb Z}$. The integrand has poles of order two at $x = x_{n}\,,\ \forall\ n\ \in {\mathbb Z}$. The result is $\color{#0000ff}{\large ? = \pi^{2}/12}$.