<s>[INST] Argument principle in the evaluation of integral 
Evaluate $$I=\int_{-\infty}^{\infty}\frac{x}{x^{2}+x+1}dx$$

Attempt: Note that $$\int_{-\infty}^{\infty}\frac{x}{x^{2}+x+1}dx=\frac{1}{2}\int_{-\infty}^{\infty}\frac{2x+1}{x^{2}+x+1}dx-\int_{-\infty}^{\infty}\frac{1}{x^{2}+x+1}dx$$
Denote $\Gamma $ as the circle with radius $R\rightarrow \infty$ and let $h=\frac{f{}'(z)}{f(z)}=\frac{2z+1}{z^{2}+z+1}$ be a holomorphic function in and on $\Gamma$. The conditions for the Argument principle are valid, and thus 
$$\Rightarrow \int_{\Gamma }\frac{f{{}'}}{f}dz=2\pi i\left ( Z-P \right )=4\pi i$$. The second integral is easily evaluated to $\frac{2\pi}{\sqrt{3}}$, and finally our integral computes to $$I=2\pi i-\frac{2\pi}{\sqrt{3}}.$$ I am certain the  wrongdoing is in using the argument principle, but how?
*Is it that $f$ is not holomorphic as $R\rightarrow \infty$?
 [/INST] Using, as you did,$$I=\int\frac{x}{x^{2}+x+1}\,dx=\frac{1}{2}\int\frac{2x+1}{x^{2}+x+1}\,dx-\int\frac{1}{x^{2}+x+1}\,dx$$
$$I=\frac{1}{2} \log \left(x^2+x+1\right)-\frac{1}{\sqrt{3}}\tan ^{-1}\left(\frac{2
   x+1}{\sqrt{3}}\right)$$ making, after simplifications,
$$J=\int_a^a\frac{x}{x^{2}+x+1}\,dx=\frac{1}{\sqrt{3}}\tan ^{-1}\left(\frac{a\sqrt{3} }{a^2-1}\right)+\frac{1}{2} \log \left(\frac{a^2+a+1}{a^2-a+1}\right)$$ For infinitely large values of $a$
$$J=-\frac{\pi }{\sqrt{3}}+\frac{2}{a}-\frac{2}{3
   a^3}+O\left(\frac{1}{a^5}\right)$$
</s>