<s>[INST] How to integrate: $\int_0^{\infty} \frac{1}{x^3+x^2+x+1}dx$ I want to evaluate $\int_0^{\infty} \frac{1}{x^3+x^2+x+1}$. The lecture only provided me with a formula for $\int_{-\infty}^{\infty}dx \frac{A}{B}$ where $A,B$ are polynomials and $B$ does not have real zeros. Unfortunately, in the given case $B$ has a zero at $z=-1$ and is not even. Is there a straight forward way to solve this in terms of complex analysis?
 [/INST] Yes there is , integrate the following function
$$f(z) = \frac{\log(z)}{z^3+z^2+z+1}$$
Around a key-hole contour. Due to the evaluation of the lines on the positive x-axis the $\log$ will cancel. What is remaining is the evaluation of the residues of the three poles.
More explanation
we have three poles $\pm i , -1$. Integrate around the following contour

$$\int_{r}^{\varepsilon}\frac{\log|x|}{x^3+x^2+x+1}dx +\int^{r}_{\varepsilon}\frac{\log|x|+2\pi i }{x^3+x^2+x+1}dx+ \int_{\gamma_r}f(z) dz +\int_{\gamma_{\varepsilon}}f(z) dz = 2\pi i \left(\mathrm{Res}(f,\pm i)+\mathrm{Res}(f,-1)\right)$$
The evaluation of the residues
$$\mathrm{Res}(f,i) = \frac{\log(i)}{3\cdot i^2+2\cdot i +1}  = \frac{i\pi/2}{2i-2} $$
$$\mathrm{Res}(f,-i) = \frac{\log(-i)}{3\cdot i^2-2\cdot i +1}  = \frac{3i\pi/2}{-2i-2}$$
$$\mathrm{Res}(f,-1) = \frac{\log(-1)}{3-2 +1}  = \frac{\pi i}{2}$$
By summing the residues and taking $r\to \infty  , \varepsilon \to 0$. Note that the complex logarithm is easily bounded hence the integrals on the smaller and bigger circles vanish and we get
$$\int^\infty_0 \frac{\log(x)}{x^3+x^2+x+1}dx -\int^ \infty_0 \frac{\log(x)+2\pi i }{x^3+x^2+x+1}dx = -\frac{\pi}{2}i$$
Hence we get
$$\int^\infty_0 \frac{\log(x)}{x^3+x^2+x+1}dx = \frac{\pi}{4}$$
</s>