Solving integral with complex path integrals Dear math stackexchange, 
I'm trying to show this:
$$ \int_{-\infty}^{\infty} \frac{e^{ax}}{1+e^x} dx = \frac{\pi}{\sin{(a\pi)}}, 0<a<1$$
I tried:
$$\int_{-\infty}^{\infty} f(x) dx =   \lim_{R\to\infty } \int_{-R}^{R} f(x) dx = \lim_{R\to\infty } \int_{-R}^{R} \frac{e^{ax}}{1+e^x} dx$$
Then i want to split the integration on the boundaries of a rectangle defined by the vertices: 
$$ z = \pm R, z = \pm R + 2 \pi i $$
This is obviously $ z \in \mathbb{C}$ so i need to expand on a complex function that covers the real of the normal function. Maybe just: $\frac{e^{az}}{1+e^z}$
Now i should just have to solve 4 path integrals, However they are quite difficult i think so i think i am on wrong path (No pun intended). 
I would love some hints and tips to go about this problem
 A: So, the thing about those path integrals - the reason you chose that path - is that some will tend to variations on the integral we want to evaluate, and the others will go to zero. That is how we use the residue theorem to evaluate integrals; we don't start with a closed path, so we come back around to close it with pieces we can understand.


*

*$\int_{-R}^R$ : This is simple - it goes to $\int_{-\infty}^{\infty} f(x)\,dx$, the integral we want to evaluate.

*$\int_{R}^{R+2\pi i}$ : $\dfrac{e^{ax}}{1+e^x} = \dfrac{e^{(a-1)x}}{1+e^{-x}}$. When the real part of $z$ is $R$ and $s$ is real, $|e^{sx}|=e^{sR}$. Applied here,
$$\left|\frac{e^{(a-1)x}}{1+e^{-x}}\right| = \frac{e^{(a-1)R}}{|1+e^{-x}|} \le \frac{e^{(a-1)R}}{1-e^{-R}}\to 0$$
Integrate that along a path of fixed length $2\pi i$, and it goes to zero.

*$\int_{R+2\pi i}^{-R+2\pi i}$ : For this, we use the identity $f(x+2\pi i) = e^{2\pi i a}f(x)$; the translation leaves the denominator unchanged, and multiplies the numerator by a fixed quantity. Since we trace this integral backwards, there's an extra $-1$ factor, and this one tends to $-e^{2\pi i a}\int_{-\infty}^{\infty}f(x)\,dx$.

*$\int_{-R+2\pi i}^{-R}$ : On this vertical segment, it's the $1$ term in the denominator that dominates. We get
$$\left|\frac{e^{ax}}{1+e^x}\right| = \frac{e^{-aR}}{|1+e^x|}\le\frac{e^{-aR}}{1-e^{-R}}\to 0$$
Integrate that along a path of fixed length $2\pi$, and it goes to zero.


Adding up the pieces, we get a limit that's a sum of two constant multiples of the integral we're trying to evaluate. In order to solve for that integral, we need a second evaluation of the contour integral - and that calls for the residue theorem. There's exactly one pole in the rectangle enclosed, at $\pi i$.
Can you take it from here?
