TITLE: Compute $ I(n) = \int^{+\infty}_{-\infty} \frac{e^{n x}}{1+e^x}\, dx$
QUESTION [7 upvotes]: 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$

REPLY [7 votes]: $$
\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)$