TITLE: Computation of an integral using residue theorem.
QUESTION [7 upvotes]: Using residue theorem compute the following integral $$\int_{-\infty}^{\infty} \frac {e^{\frac {x} {2}}} {1 + e^x}\ dx.$$

I have tried to proceed by the method of substitution by taking $y = e^{\frac {x} {2}}.$ Then $dy = \frac {1} {2} e^{\frac {x} {2}}\ dx$ i.e. $e^{\frac {x} {2}}\ dx = 2\ dy.$ Then the limit of integration becomes $0$ to $\infty.$ So by this substitution the integral becomes $$2 \int_{0}^{\infty} \frac {dy} {1 + y^2} = 2 \lim\limits_{x \to \infty} \arctan x = \pi.$$
By residue theorem how to deal with the same integral? Any help in this regard would be much appreciated.
Thanks for your time.

REPLY [2 votes]: alternatively:
$$\int\limits_{\mathbb R}\frac{e^{x/2}}{1+e^{x}}dx=\int\limits_{\mathbb R}\frac{dx}{e^{x/2}+e^{-x/2}}$$
making the substitution $u=x/2\Rightarrow dx=2du$ we get:
$$2\int\limits_{\mathbb R}\frac{du}{e^u+e^{-u}}=\int\limits_{\mathbb R}\operatorname{sech}(u)\,du=\pi$$

Or as others have said make the substitution $u=e^{x/2}$ and you will get something in terms of $\arctan$