Evaluation of definite integral using residue theorem $$ \int^{+\infty}_{-\infty} \frac{x-1}{x^3-1} dx$$
I need to evaluate the above integral . 
My idea is to consider the same integral but with the $x$'s as $z$'s, over the complex plane, have a closed contour integral over $\gamma$, and then use the residue theorem. i.e. consider: 
$$ \int^{+\infty}_{-\infty} \frac{z-1}{z^3-1} dz$$
I'm stuck on how to formulate $\gamma$ though.
I know this has 3 poles: at 
$z=1$, $z= \frac{-1}{2} + i\frac{\sqrt3}{2}$ and $z= \frac{-1}{2} - i\frac{\sqrt3}{2}$
How do I use this to divide up gamma over contours to which I can then use the residue theorem? And then do I have to either evaluate directly or apply the ML inequality to each individual contour?
 A: This seems quite silly to use complex analysis for.
$$\begin{aligned}\int_{-\infty}^{\infty}\frac{x-1}{x^3-1}\,dx &=\int_{-\infty}^\infty \frac{dx}{1+x+x^2}\\ &= \frac{2}{\sqrt{3}}\arctan\left(\frac{2x+1}{\sqrt{3}}\right)\mid_{-\infty}^{\infty}\\ &= \frac{2\pi}{\sqrt{3}}\end{aligned}$$

If you're hell-bent on using the Residue Theorem though, let $\Gamma_R$ be the semi-cicular contour in the upper half-plane which is centered at $0$ and of radius $R$. Then, you know that 
$$\int_{\Gamma_R}\frac{1}{z^2+z+1}\,dz = \int_{-R}^{R}\frac{dx}{1+x+x^2}+\int_{A_R}\frac{dz}{1+z+z^2}$$
where $A_R$ is the upper circular arc of $\Gamma_R$. Now, $\displaystyle \frac{1}{1+z+z^2}$ has only one pole in the interior of $\Gamma_R$, at $\displaystyle z_0=\frac{-1}{2}+i\frac{\sqrt{3}}{2}$. 
Thus, you see that for every $R$ the Residue Theorem gives
$$\int_{\Gamma_R}\frac{dz}{1+z+z^2}=2\pi i\, \text{Res}\left(\frac{1}{1+z+z^2},z_0\right)$$
Thus, if you can show that 
$$\displaystyle \int_{A_R}\frac{dz}{z^2+z+1}\xrightarrow{R\to\infty}0$\quad\mathbf{(1)}$$
You will have that 
$$\int_{-\infty}^{\infty}\frac{dx}{1+x+x^2}=2\pi i\, \text{Res}\left(\frac{1}{1+z+z^2},z_0\right)$$
The residue, as I've said, is up to you. To prove $\mathbf{(1)}$ let me give you a hint: Jordan's Lemma.
A: Note that $\frac{x - 1}{x^3 - 1} = \frac{1}{x^2 + x + 1}$. So the integral is
$$
\int_{-\infty}^{+\infty} \frac{1}{x^2 + x + 1} \, dx.
$$
First take the integral from $-a$ to $a$ and then take the limit after. Just complete the square in the denominator and use substitution to get an integral in terms of $\arctan$.
$$
\int_{-a}^{a} \frac{1}{(x + \frac{1}{2})^2 + \frac{3}{4}} \, dx \\
=\frac{4}{3}\int_{-a}^{a} \frac{1}{\left(\frac{2}{\sqrt{3}}(x + \frac{1}{2})\right)^2 + 1} \, dx.
$$
Using the substitution $u = \frac{2}{\sqrt{3}}(x + \frac{1}{2})$, we have $dx = \frac{\sqrt{3}}{2}du$ and so the indefinite integral is
$$
\frac{4}{3}\frac{\sqrt{3}}{2}\int \frac{1}{u^2 + 1} \, dx \\
=\frac{2}{\sqrt{3}}\arctan(u) = \frac{2}{\sqrt{3}}\arctan\left(\frac{1}{\sqrt{3}}(2x + 1)\right).
$$
Thus, the definite integral is
$$
\left.\frac{2}{\sqrt{3}}\arctan\left(\frac{1}{\sqrt{3}}(2x + 1)\right)\right|_{-a}^a = \frac{2}{\sqrt{3}}\arctan\left(\frac{1}{\sqrt{3}}(2a + 1)\right) - \frac{2}{\sqrt{3}}\arctan\left(\frac{1}{\sqrt{3}}(-2a + 1)\right).
$$
As $a \to \infty$, we have $\arctan\left(\frac{1}{\sqrt{3}}(2a + 1)\right) \to \frac{\pi}{2}$ and $\arctan\left(\frac{1}{\sqrt{3}}(-2a + 1)\right) \to -\frac{\pi}{2}$. Hence the integral is
$$
\int_{-\infty}^{+\infty} \frac{x - 1}{x^3 - 1} \, dx= \frac{2}{\sqrt{3}} \cdot \frac{\pi}{2} + \frac{2}{\sqrt{3}} \cdot \frac{\pi}{2} = \frac{2\pi}{\sqrt{3}}.
$$
A: If you really insist in complex analysis, define:
$$f(z):=\frac{z-1}{z^3-1}=\frac{1}{z^2+z+1}\,\,,\,\,C_R:=[-R,R]\cup\Gamma_R:=\{z\in\Bbb C\;;\;|z|=R\,,\,\,\Im(z)\ge 0\}$$
so that we have the integral
$$\oint\limits_{C_R}f(z)\,dz=\int\limits_{-R}^R\frac{dx}{x^2+x+1}+\int\limits_{\Gamma_R}f(z)\,dz$$
Now, we have $\,\displaystyle{z^2+z+1=0\iff z=\frac{-1\pm\sqrt 3\,i}{2}=e^{\pm\frac{2\pi i}{3}}}\,$ , but since we're working only on the upper half plane, we only have one simple pole there:
$$Res_{z=e^{2\pi i/3}}(f)=\lim_{z\to e^{2\pi i/3}}\,\left(z-e^{\frac{2\pi i}{3}}\right)f(z)\stackrel{\text{for ex., L'Hospital}}=$$
$$=\frac{1}{2e^{\frac{2\pi i}{3}}+1}=\frac{1}{\sqrt 3\,i}$$
Also, by Cauchy's Evaluation Theorem:
$$\left|\,\,\int\limits_{\Gamma_R}f(z)\,dz\,\,\right|\le\frac{1}{R^2-R-1}\cdot\pi R\xrightarrow [R\to\infty]{}0$$
So by Cauchy's residue Theorem and passing to the limit:
$$\frac{2\pi}{\sqrt 3}=2\pi i\cdot\frac{1}{\sqrt 3\,i}=\lim_{R\to\infty}\int\limits_{C_R}f(z)\,dz=\int\limits_{-\infty}^\infty\frac{dx}{x^2+x+1}$$
