I need to prove that $\displaystyle\int_{-\infty}^{\infty} \dfrac{e^{-x}}{1+e^{-2\pi x}}\,dx=\dfrac{1}{2\sin\left(\frac{1}{2}\right)}$. This is an exercise from Basic Complex Analysis by Marsden and Hoffman. My attempt:
First, Marsden says that we need to consider the complex function $f(z)=\dfrac{e^{-z}}{1+e^{-2\pi z}}$ and the next curve
$\gamma_2=r+t\pi i$ with $t\in [0,1]$
$\gamma_3=(\pi i+r)-2tr$ with $t\in [0,1]$
$\gamma_4=(1-t)(\pi i-r)-tr$ with $t\in [0,1]$
Note that the only poles of the function $f(z)$ in the rectangle are when $z=\dfrac{i}{2}$, $z=\dfrac{3i}{2}$ and $z=\dfrac{5i}{2}$. From a direct calculation we obtain that $\text{Res}\left(f(z),\dfrac{i}{2}\right)=\dfrac{e^{-i/2}}{2\pi}$, $\text{Res}\left(f(z),\dfrac{3i}{2}\right)=\dfrac{e^{-3i/2}}{2\pi}$ and $\text{Res}\left(f(z),\dfrac{5i}{2}\right)=\dfrac{e^{-5i/2}}{2\pi}$.
After to a lot of calculations we obtain a bound for the integral over $\gamma_2$: $$\dfrac{e^{-r}}{\sqrt{(1-e^{-2\pi r})^2}}\geq \dfrac{|e^{-r-t\pi i}|}{|1+e^{-2\pi(r+t\pi i)}|}\geq 0$$Thus $$\displaystyle\int_{\gamma_2}^{}f(\gamma_2)\cdot d\gamma\leq \dfrac{e^{-r}}{\sqrt{(1-e^{-2\pi r})^2}}$$When $r\to\infty$ then $\displaystyle\int_{\gamma_2}^{}f(\gamma_2)\cdot d\gamma\to 0$
I think that is the same for $\gamma_4$ but I have troubles with $\gamma_3$. After a lot of calculations we obtain the next bound: $$\dfrac{e^{-r+2rt}}{\sqrt{1+2e^{-2\pi}\cos(-2\pi^2)+e^{-4\pi r}}}\geq \dfrac{|e^{-r+2rt-\pi i}|}{|1+e^{-2\pi(\pi i+r-2rt)}|}$$ but when $r\to\infty$ we obtain that $\dfrac{e^{-r+2rt}}{\sqrt{1+2e^{-2\pi}\cos(-2\pi^2)+e^{-4\pi r}}}\to\infty$ and I need, maybe, that this limits exists (maybe, zero).
Clearly I want the integrals over the curves because if $\gamma=\gamma_1\cup\gamma_2\cup\gamma_3\cup\gamma_4$ then $\displaystyle\int_{\gamma} f(\gamma)\cdot d\gamma=\displaystyle\int_{\gamma_1} f(\gamma_1) \cdot d\gamma_1+\displaystyle\int_{\gamma_2} f(\gamma_2) \cdot d\gamma_2+\displaystyle\int_{\gamma_3} f(\gamma_3) \cdot d\gamma_3+\displaystyle\int_{\gamma_4} f(\gamma_4) \cdot d\gamma_4$ and I want to use the Residue Theorem. But, is the rectangle the correct curve? Here an screenshot of the exercise: