Residue integral: $\int_{- \infty}^{+ \infty} \frac{e^{ax}}{1+e^x} dx$ with $0 \lt a \lt 1$. I'm self studying complex analysis. I've encountered the following integral:
$$\int_{- \infty}^{+ \infty} \frac{e^{ax}}{1+e^x} dx \text{ with } a \in \mathbb{R},\  0 \lt a \lt 1. $$
I've done the substitution $e^x = y$. What kind of contour can I use in this case ?
 A: there is a nice question related with this problem , and we can evaluate it by using Real analysis
$$I=\int_{-\infty }^{\infty }\frac{e^{ax}}{1-e^{x}}dx,\ \ \ \ \ \ \ \     (*)\ \ \ \ \ 0<a<1\\
\\
let \ x\rightarrow -x \ \ then\ \ I=\int_{-\infty }^{\infty }\frac{e^{-ax}}{1-e^{-x}}\ \ \ \ \ (**)\\
\\
adding\ (*)\ and\ (**)\ \ then\  2I=\int_{-\infty }^{\infty }[\frac{e^{ax}}{1-e^x}+\frac{e^{-ax}}{1-e^{-x}}]dx\\
\\
\therefore I=\frac{1}{2}\int_{-\infty }^{\infty }(\frac{e^{-ax}}{1-e^{-x}}-\frac{e^{-(1-a)x}}{1-e^{-x}})dx\\
\\
\therefore I==\frac{1}{2}\int_{-\infty }^{\infty }[(\frac{e^{-x}}{x}-\frac{e^{-(1-a)x}}{1-e^{-x}})-(\frac{e^{-x}}{x}-\frac{e^{-ax}}{1-e^{-x}})]dx\\
\\
\\
\therefore \therefore I=\int_{0}^{\infty }(\frac{e^{-x}}{x}-\frac{e^{-(1-a)x}}{1-e^{-x}})dx-\int_{0}^{\infty }(\frac{e^{-x}}{x}-\frac{e^{-ax}}{1-e^{-x}})dx\\
\\
\\
\therefore I=\Psi (1-a)-\Psi (a)=\frac{\pi }{tan(\pi a)}$$
this problem proposed by cornel loan, it is very easy to solve by complex analysis, but splendid to evaluate by"Real analysis"
A: The substitution $e^x=y$ leads to the integral
$$
\int_0^\infty\frac{y^{a-1}}{y+1}\,dy.
$$
This can be computed integrating the function $f(z)=z^{a-1}/(z+1)$ along the keyhole contour. We consider the branch of $z^{a-1}$ defined on $\mathbb{C}\setminus[0,\infty)$ with $f(-1)=e^{\pi i}$. For small $\epsilon>0$ and large $R>0$, he contour is made up of the interval $[\epsilon,R]$, the circle $C_r=\{|z|=R\}$ counterclockwise, the interval $[R,\epsilon]$ and the circle $C_\epsilon=\{|z|=\epsilon\}$ clockwise. The function $f$ has a simple pole at $z=-1$ with residue $(-1)^{a-1}=e^{\pi(a-1)i}$. It is easy to see that
$$
\lim_{\epsilon\to0}\int_{C_\epsilon}f(z)\,dz=\lim_{R\to\infty}\int_{C_R}f(z)\,dz=0.
$$
Then
$$
\int_0^\infty\frac{y^{a-1}}{y+1}\,dy+\int_\infty^0\frac{(e^{2\pi i}y)^{a-1}}{y+1}\,dy=2\,\pi\,i\operatorname{Res}(f,-1),
$$
from where
$$
\bigl(1-e^{2\pi(a-1)i}\bigr)\int_0^\infty\frac{y^{a-1}}{y+1}\,dy=2\,\pi\,i\,e^{\pi(a-1)i}
$$
and
$$
\int_0^\infty\frac{y^{a-1}}{y+1}\,dy=\frac{\pi}{\sin((1-a)\pi)}.
$$
