How to integrate $\int_0^{\infty} \frac{e^{ax} - e^{bx}}{(1 + e^{ax})(1+ e^{bx})}dx$ where $a,b > 0$.

\begin{align} \int_0^{\infty} \frac{e^{ax} - e^{bx}}{(1 + e^{ax})(1+ e^{bx})}dx&=\int_{0}^{\infty}\left(\frac{1}{1+e^{bx}}-\frac{1}{1+e^{ax}}\right)dx \\ &=\int_{0}^{\infty}\left(\frac{e^{-bx}}{1+e^{-bx}}-\frac{e^{-ax}}{1+e^{-ax}}\right)dx \\ &=-\frac1{b}\int_{0}^{\infty}\frac{1}{1+e^{-bx}}d(e^{-bx})+\frac1{a}\int_{0}^{\infty}\frac{1}{1+e^{-ax}}d(e^{-ax}) \\ &=-\frac1{b}\int_{1}^{0}\frac{1}{1+t}dt+\frac1{a}\int_{1}^{0}\frac{1}{1+t}dt \\ &=\left(\frac1{b}-\frac1{a}\right)\log{2} \end{align}


You do not need complex integration, just Fubini's theorem: $$\begin{eqnarray*}I=\int_{0}^{+\infty}\left(\frac{1}{1+e^{bx}}-\frac{1}{1+e^{ax}}\right)\,dx&=&-\int_{0}^{+\infty}\int_{a}^{b}\frac{ x\, e^{xy}}{(1+e^{xy})^2}\,dy\,dx\\&=&-\int_{a}^{b}\int_{0}^{+\infty}\frac{ x\, e^{xy}}{(1+e^{xy})^2}\,dx\,dy\\&=&-\int_{a}^{b}\frac{\log 2}{y^2}\,dy\\&=&\color{red}{\left(\frac{1}{b}-\frac{1}{a}\right)\log 2}.\end{eqnarray*} $$ As a matter of fact, we just need to compute: $$ \int_{0}^{+\infty}\frac{dx}{1+e^x}=\int_{1}^{+\infty}\frac{dt}{t(1+t)}=\int_{0}^{1}\frac{du}{1+u}=\log 2$$ that is straightforward by setting $x=\log t$, then $t=\frac{1}{u}$.


A real pedestrian approach would be as follows:

Let us define $J(c):=\int_{0}^{\infty}\frac{1}{1+e^{cx}}=\int_{0}^{\infty}\frac{e^{-cx}}{1+e^{-cx}}$, then we can apply geometric series to obtain

$$ J(c)=\int_{0}^{\infty}\frac{1}{1+e^{cx}}=\sum_{n=0}^{\infty}(-1)^n\int_{0}^{\infty}e^{-(n+1)cx}=\frac1c\sum_{n=0}^{\infty}\frac{(-1)^n}{n+1} $$

Employing the Taylor series of $\log$ we get $$ J(c)=\frac{\log(2)}{c} $$

Now observe that the original integral $I(a,b)$ is given by

$$ I(a,b)=J(a)-J(b)=\log(2)\left(\frac{1}{a}-\frac{1}{b}\right) $$

in agreement with all other answers Contour integration is tricky here, maybe i will come up with something tomorrow