TITLE: Infinite integrals$\int_0^{ + \infty } {\frac{1}{{\left( {x + 1} \right)\left( {{x^n} + 1} \right)}}dx} .$
QUESTION [5 upvotes]: How to calculate
$$\int_0^{ + \infty } {\frac{1}{{\left( {x + 1} \right)\left( {{x^n} + 1} \right)}}dx} .$$

REPLY [2 votes]: For odd values of n, use the fact that $~\dfrac n{(1+x)(1+x^n)}~=~\dfrac1{(1+x)^2}~+~\dfrac{P_{n-2}(x)}{1+x^n}~,~$ where 
$P_{n-2}(x)~=~\displaystyle\sum_{k=0}^{n-2}(n-k-1)(-x)^k,~$ in conjunction with the famous identity $~\displaystyle\int_0^\infty\frac{x^{a-1}}{1+x^n}~dx$
$=~\dfrac\pi n\cdot\csc\bigg(a~\dfrac\pi n\bigg),~$ which can be proven using the substitution $t=\dfrac1{1+x^n}~,~$ followed by 
recognizing the expression of the beta function in the new integral, and then employing Euler's 
reflection formula for the $\Gamma$ function to simplify the result. For even values of n, a similar trick 
applies, with the caveat that the new formulas are $~\dfrac2{(1+x)(1+x^n)}~=~\dfrac1{1+x}~+~\dfrac{R_{n-1}(x)}{1+x^n}~,~$ 
where $~R_{n-1}(x)~=~\displaystyle\sum_{k=0}^{n-1}(-x)^k,~$ and the rather important observation that, for even values 
of n, $~\displaystyle\int_0^\infty\bigg(\frac1{1+x}-\frac{x^{n-1}}{1+x^n}\bigg)~dx~=~0.$