<s>[INST] Which contour is best for $\int_0^\infty\frac{1}{x^2 + x + 1}dx$ The following is a complex analysis problem.  Does anyone have any idea what contour would be good to use?

$$\int_0^\infty\frac{1}{x^2 + x + 1}dx$$

Its roots on the bottom are are $\frac{-1 \pm i\sqrt{3}}{2}$.
 [/INST] Let $ \displaystyle f(z) = \frac{\log z}{z^{2}+z+1}$ and integrate around a keyhole contour where the branch cut for $\log z$ is placed on the positive real axis.
As the radius of the little circle goes to $0$ and the radius of the big circle goes to $\infty$, $ \int f(z) \ dz$ will vanish along both circles. You can use the ML inequality to show this.
So integrating counterclockwise around the contour, 
$$ \int_{0}^{\infty} \frac{\log x}{x^{2}+x+1} \ dx + \int_{\infty}^{0} \frac{\log x + 2 \pi i }{x^{2}+x+1} \ dx = 2 \pi i \Big(\text{Res} [f(z), e^{2 \pi i /3}] + \text{Res}[f(z), e^{4 \pi i /3}] \Big)$$
where
$$\text{Res} [f(z), e^{2 \pi i /3}] = \lim_{z \to e^{2 \pi i /3}} \frac{\log z}{2z+1} = \frac{2 \pi i /3}{2e^{2 \pi i /3}+1} = \frac{2 \pi}{3 \sqrt{3}} $$
and
$$ \text{Res} [f(z), e^{4 \pi i /3}] = \lim_{z \to e^{4 \pi i /3}} \frac{\log z}{2z+1} = \frac{4 \pi i /3}{2e^{4 \pi i /3}+1} = - \frac{4 \pi}{3 \sqrt{3}}. $$
Therefore,
$$ -2 \pi i \int_{0}^{\infty} \frac{1}{x^{2}+x+1} \ dx = 2 \pi i \left(- \frac{2 \pi}{3 \sqrt{3}} \right) $$
which implies
$$ \int_{0}^{\infty} \frac{1}{x^{2}+x+1} \ dx = \frac{2 \pi }{3 \sqrt{3}} .$$
</s>