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.
 A: 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}$$
A: $\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}
{\Large ?} &\equiv \int_{0}^{\infty}{x \over \expo{x} + 1}\,\dd x =
\int_{0}^{\infty}{x\expo{-x} \over 1 + \expo{-x}}\,\dd x =
\sum_{n = 0}^{\infty}\pars{-1}^{n}\int_{0}^{\infty}x\expo{-\pars{n + 1}x}\,\,\dd x
\\[5mm] & =
\sum_{n = 0}^{\infty}{\pars{-1}^{n} \over \pars{n + 1}^{2}} =
-\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over n^{2}} =
\sum_{\substack{n = 1 \\[0.5mm] n\ odd}}^{\infty}{1 \over n^{2}} -
\sum_{\substack{n = 1 \\[0.5mm] n\ even}}^{\infty}{1 \over n^{2}}
\\[5mm] & =
\sum_{n = 1}^{\infty}{1 \over n^{2}} -
2\sum_{n = 1}^{\infty}{1 \over \pars{2n}^{2}} =
{1 \over 2}\sum_{n = 1}^{\infty}{1 \over n^{2}} =
\bbox[10px,border:1px groove navy]{\pi^{2} \over 12} \\ &
\end{align}
