Compute $ I(n) = \int^{+\infty}_{-\infty} \frac{e^{n x}}{1+e^x}\, dx$ I need compute this definite integral for values 0 < n < 1. I am not sure how to begin at all. I was able to compute the indefinite integral for the special case of n = 1/2, but I am unable to use the same strategies of substitution.
$I(n) = \int^{+\infty}_{-\infty} \dfrac{e^{nx}}{1+e^x}\, dx$
 A: $$
\begin{align}
\int_{-\infty}^\infty\frac{e^{nx}}{1+e^x}\mathrm{d}x
&=\int_{-\infty}^\infty\frac{e^{(n-1)x}}{1+e^x}\mathrm{d}e^x\\
&=\int_0^\infty\frac{t^{n-1}}{1+t}\mathrm{d}t\tag{1}\\[5pt]
&=\mathrm{B}(n,1-n)\tag{2}\\[10pt]
&=\Gamma(n)\Gamma(1-n)\tag{3}\\[5pt]
&=\frac{\pi}{\sin(\pi n)}\tag{4}
\end{align}
$$
$(1)$: $t=e^x$
$(2)$: Beta Function identity
$(3)$: Beta Function identity using $\Gamma(n+(1-n))=\Gamma(1)=1$
$(4)$: Gamma function identity
The identities in both $(2)$ and $(3)$ are justified in this answer.
The identity in $(4)$ is justified in this answer.
The special case of $n=\frac12$ thus yields a value of $\pi$. If that is all you are really interested in, we can simplify the preceding argument as follows:
$$
\begin{align}
\int_{-\infty}^\infty\frac{e^{x/2}}{1+e^x}\mathrm{d}x
&=\int_{-\infty}^\infty\frac{e^{-x/2}}{1+e^x}\mathrm{d}e^x\\
&=\int_0^\infty\frac{1/t}{1+t^2}\mathrm{d}t^2\tag{5}\\
&=2\int_0^\infty\frac1{1+t^2}\mathrm{d}t\tag{6}\\[9pt]
&=\pi\tag{7}
\end{align}
$$
$(5)$: $t^2=e^x$
$(7)$: substitute $t=\tan(\theta)$
A: You can use a semicircle in the upper half plane in the complex plane.  That is, consider
$$\oint_C dz \frac{e^{n z}}{1+e^z}$$
where $C$ is the semicircle of radius $R$.  Then the contour integral is equal to
$$\int_{-R}^R dx  \frac{e^{n x}}{1+e^x} + i R \int_0^{\pi} d\theta \, e^{i \theta} \frac{e^{n R \cos{\theta}} e^{i n R \sin{\theta}}}{1+e^{R \cos{\theta}} e^{i R \sin{\theta}}}$$
As $R \to \infty$, the magnitude of the second integral vanishes by Jordan's Lemma because $n \in (0,1)$.  By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $z_k = i (2 k+1) \pi$ for $k \in \{0,1,2,\ldots\}$. Thus,
$$\int_{-\infty}^{\infty} dx  \frac{e^{n x}}{1+e^x} = -i 2 \pi \sum_{k=0}^{\infty} e^{i (2 k+1) \pi n} = -i 2 \pi \frac{e^{i \pi n}}{1-e^{i 2 \pi n}} = \frac{\pi}{\sin{\pi n}}$$
