proving an identity of an improper integral I want to show that
$$
\int_{-\infty}^{\infty}\,\frac{{\rm e}^{-x}}{1+{\rm e}^{-2\pi x}}\,{\rm d}x
=\frac{1}{2\sin\left(\,1/2\,\right)}
$$
by using the residue theorem, I have considered the contour integral of  the function $\displaystyle{\rm f}\left(\,z\,\right)=\frac{{\rm e}^{-zi}}{1+{\rm e}^{-2\pi z}}$  over the lower half circle with radius $r$ and the union of the closed interval
$\left[\,-r,r\,\right]$ since the function is equal to the integrand of the integral on the real axes.
But I haven't got the right hand side of the equation. Thanks for any help.
 A: $\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{\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{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#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}&\overbrace{\color{#66f}{\large\int_{-\infty}^{\infty}%
{\expo{-x} \over 1 + \expo{-2\pi x}}\,\dd x}}
^{\ds{\color{#c00000}{\expo{-x} \equiv t\ \imp\ x = -\ln\pars{t}}}}\ =\
\int_{\infty}^{0}{t \over 1 + t^{2\pi}}\,\pars{-\,{\dd t \over t}}\ =\ 
\overbrace{\int_{0}^{\infty}{\dd t \over 1 + t^{2\pi}}}
^{\ds{\color{#c00000}{t^{2\pi}\ \mapsto\ t}}}
\\[5mm]&=\color{#c00000}{{1 \over 2\pi}\int_{0}^{\infty}
{t^{1/\pars{2\pi} - 1} \over 1 + t}\,\dd t}
\\[5mm]&={1 \over 2\pi}\braces{2\pi\ic\exp\pars{\ic\pi\bracks{{1 \over 2\pi} - 1}}
-\int_{\infty}^{0}t^{1/\pars{2\pi} - 1}
\exp\pars{2\pi\ic\bracks{{1 \over 2\pi} - 1}}\,{\dd t \over 1 + t}}
\\[5mm]&=-\ic\expo{\ic/2}
+\expo{\ic}\color{#c00000}{{1 \over 2\pi}\int_{0}^{\infty}
{t^{1/\pars{2\pi} -1} \over 1 + t}\,\dd t}
\end{align}

Then,
  \begin{align}&\color{#66f}{\large\int_{-\infty}^{\infty}%
{\expo{-x} \over 1 + \expo{-2\pi x}}\,\dd x}
=\color{#c00000}{{1 \over 2\pi}\int_{0}^{\infty}
{t^{1/\pars{2\pi} -1} \over 1 + t}\,\dd t}
={-\ic\expo{\ic/2} \over 1 - \expo{\ic}}
={-\ic \over \expo{-\ic/2} - \expo{\ic/2}}
\\[5mm]&={-\ic \over 2\ic\sin\pars{-1/2}}
=\color{#66f}{\large{1 \over 2\sin\pars{1/2}}} \approx {\tt 1.0429}
\end{align}

A: Hint.  Integrate
$$f(z)=\frac{e^{-z}}{1+e^{-2\pi z}}$$
over the rectangle with vertices at $a$ and $a+i$ and $-a+i$ and $-a$.
Supplementary hint.  You should get
$$J=ie^{-i/2}$$
for the complex integral.  If $I$ is the real integral you are looking for then as $a\to\infty$ you should find
$$\int_{\rm bottom\atop side}f(z)\,dz\to I\ ,\qquad
  \int_{\rm top\atop side}f(z)\,dz\to-e^{-i}I$$
and the integrals along the vertical sides tend to zero.  Putting it all together you will find that the imaginary bits cancel and you are left with a real result for $I$.
