Calculate $ \intop_{0}^{\infty}\frac{1}{x^{6}+x^{3}+1}dx $ (Using line integral) (complex analysis) I want to calculate the integral $$ \intop_{0}^{\infty}\frac{1}{x^{6}+x^{3}+1}dx $$  using a line integral $\varGamma $ which is the boundary of an arc of a circle of radius $ R $ and $ 0\leq Arg(z) \leq 2\pi/3 $
Such a path $\gamma $ is sort of a slice of pizza.
Now I'm gonna denote this path $ \gamma $ and decompose it into 3 parts.
One part - the part that lies on the real axis, given by $ x, R\leq x \leq 0 $.
Second part - the arc of the circle which we'll parametrize $ Re^{i\theta},\thinspace\thinspace\thinspace0\leq\theta\leq\frac{2\pi}{3} $
And the last part, a ray from the origin with phase $2\pi/3 $ and length R (the radius of this pizza slice), which we'll parametrize $ xe^{i\frac{2\pi}{3}}\thinspace\thinspace\thinspace0\leq x\leq R $
So we get $$ \intop_{\gamma}\frac{1}{z^{6}+z^{3}+1}dz=\intop_{0}^{R}\frac{1}{x^{6}+x^{3}+1}dx-\intop_{0}^{R}\frac{e^{i\frac{2\pi}{3}}}{x^{6}+x^{3}+1}dx+\intop_{0}^{\frac{2\pi}{3}}\frac{Rie^{i\theta}}{R^{6}e^{6i\theta}+R^{3}e^{3i\theta}+1}d\theta $$
And notice that $$ \intop_{0}^{\frac{2\pi}{3}}\frac{Rie^{i\theta}}{R^{6}e^{6i\theta}+R^{3}e^{3i\theta}+1}d\theta \to 0 $$
When $ R \to \infty $.
Also, by the Residue theorem of Cauchy, we get $$ \intop_{\gamma}\frac{1}{z^{6}+z^{3}+1}dz=2\pi i\text{Res}\left(\frac{1}{z^{6}+z^{3}+1};z_{k}\right) $$
So when $ R \to \infty $, the line integral would be the summation of all the poles of the integrand inside $\gamma$, that is, all the poles with the argument between $ 0 $ and $2\pi/3$.
Now I have checked, and found that the poles of $f $ which satisfies this conditions are $ e^{i\frac{2\pi}{9}},e^{i\frac{4\pi}{9}} $
So that $$ 2\pi i\left(\text{Res}\left(\frac{1}{z^{6}+z^{3}+1};e^{i\frac{2\pi}{9}}\right)+\text{Res}\left(\frac{1}{z^{6}+z^{3}+1};e^{i\frac{4\pi}{9}}\right)\right)=\left(1-i\frac{2\pi}{3}\right)\intop_{0}^{\infty}\frac{1}{x^{6}+x^{3}+1}dx $$
Now, for a function which has a simple pole at $z_k$ we can write the function as $ \frac{A\left(z\right)}{B\left(z\right)} $ where $B$ has a zero at the pole and $ A $ does not have a zero. And the residue is given by $$\lim_{z\to z_{k}}\left(z-z_{k}\right)\frac{A\left(z\right)}{B\left(z\right)}=\frac{A\left(z\right)}{B'\left(z\right)} $$ evaluated at $z_{k}$
So in order to find the residue of my poles, I found the derivative of the denominator and let z= the pole. So finally I got after all the calculations that the integral should be $$ \left(\frac{1}{6e^{i\frac{10}{9}\pi}+3e^{i\frac{4}{9}\pi}+1}+\frac{1}{6e^{i\frac{20}{9}\pi}+3e^{i\frac{4}{9}\pi}+1}\right)2\pi i\frac{1}{1-e^{i\frac{2}{3}\pi}} $$
Which is not real (I checked, unfortunately)
What am I missing? what went wrong?
Thanks in advance.
 A: I had a few calculations mistakes: the correct calculation would be the following:
The residue at the poles I mentioned given by
$$ \text{Res}\left(\frac{1}{z^{6}+z^{3}+1};e^{i\frac{2\pi}{9}}\right)=\frac{1}{\left(z^{6}+z^{3}+1\right)'}|_{z=e^{i\frac{2\pi}{9}}}=\frac{1}{6e^{i\frac{10}{9}\pi}+3e^{i\frac{4\pi}{9}}} $$
And $$ \text{Res}\left(\frac{1}{z^{6}+z^{3}+1};e^{i\frac{4\pi}{9}}\right)=\frac{1}{\left(z^{6}+z^{3}+1\right)'}|_{z=e^{i\frac{4\pi}{9}}}=\frac{1}{6e^{i\frac{20}{9}\pi}+3e^{i\frac{8\pi}{9}}} $$
So we get on the LHS
$$ 2\pi i\left(\frac{1}{6e^{i\frac{10}{9}\pi}+3e^{i\frac{4\pi}{9}}}+\frac{1}{6e^{i\frac{10}{9}\pi}+3e^{i\frac{2\pi}{9}}}\right) $$
and on the RHS $$ \intop_{0}^{\infty}\frac{1}{x^{6}+x^{3}+1}dx+\intop_{0}^{\infty}\frac{-e^{i\frac{2\pi}{3}}}{x^{6}+x^{3}+1}dx $$
So eventually $$ \intop_{0}^{\infty}\frac{1}{x^{6}+x^{3}+1}dx=\left(\frac{1}{6e^{i\frac{10}{9}\pi}+3e^{i\frac{4}{9}\pi}+1}+\frac{1}{6e^{i\frac{20}{9}\pi}+3e^{i\frac{8}{9}\pi}+1}\right)2\pi i\frac{1}{1-e^{i\frac{2}{3}\pi}} $$
Which apparently is a real number which is approximated form is $\approx$ 0.8975
A: In order to reduce the number of residues and to simplify calculation you can make the substitution:
$$I=\int_{0}^{\infty}\frac{1}{x^{6}+x^{3}+1}dx=(t=x^3)\,\,\,\,\frac{1}{3}\int_0^\infty\frac{t^{-2/3}}{t^2+t+1}dt$$
Next we can go in the complex plane and integrate along the following contour with the cut from $0$ to $\infty$ along the axis $X$.

After the full turn the integrand gets the factor $e^{(2\pi i)(-2/3)}=e^{-4\pi i/3}$. We also have to bear in mind that we integrate from $\infty$ to $0$ along the lower bank of the cut (additional minus).
The integral along the big circle $\to 0$ as $R\to\infty$, and we get:
$$I(1-e^{-4\pi i/3})=2\pi i \sum Res \frac{1}{3}\frac{z^{-2/3}}{z^2+z+1}$$
The roots of the denominator are $z_1=e^{2\pi i/3}$ and $z_2=e^{4\pi i/3}$, so we have two poles inside the contour.
$$I(1-e^{-4\pi i/3})=\frac{2\pi i}{3} \sum Res \frac{z^{-2/3}}{(z-z_1)(z-z_2)}=\frac{2\pi i}{3} \frac{z_1^{-2/3}-z_2^{-2/3}}{z_1-z_2}$$
$$I\,e^{-2\pi i/3}\big(e^{2\pi i/3}-e^{-2\pi i/3}\big)=\frac{2\pi i}{3}\frac{e^{-6\pi i/9}\big(e^{2\pi i/9}-e^{-2\pi i/9}\big)}{e^{\pi i}\big(e^{-\pi i/3}-e^{\pi i/3}\big)}$$
$$I=\frac{\pi}{3}\,\frac{\sin(2\pi/9)}{\sin(2\pi/3)\sin(\pi/3)}=\frac{\pi}{3}\,\frac{\sin(2\pi/9)}{\sin^2(\pi/3)}=\frac{4\pi}{9}\,\sin(2\pi/9)$$
