<s>[INST] How to Solve $ \int \frac{dx}{x^3-1} $ I am having quite a difficult time integrating
$$
\int  \frac{\mathrm{d}x}{x^3-1}
$$
My first approach was to apply a partial fraction decomposition
$$
\int \frac{\mathrm{d}x}{x^3-1} = \int \frac{\mathrm{d}x}{(x-1)(x^2+x+1)} = \frac{1}{3} \int \frac{\mathrm{d}x}{x-1} - \frac{1}{3} \int \frac{x+2}{x^2+x+1}\mathrm{d}x$$
The first term is simple enough to integrate but I can't figure out the second.  I've tried each of the integration tricks in my arsenal, integration of parts gives a more complex equation, a trigonometric substitution doesn't seem to get me anywhere, and lastly I'm not sure what to do with a u-substitution since if $ u = x^2+x+1 $ then $ \mathrm{d}u = (2x+1)\mathrm{d}x \neq (x+2)\mathrm{d}x $.  And further breaking up the formula further doesn't seem to eliminate these problems.  
My last effort was to get a solution from Wolfram and try to reverse engineer it by taking the derivative
$$
\frac{\mathrm{d}}{\mathrm{d}x} \left( - \frac{1}{6} \ln (x^2+x+1) + \frac{1}{3} \ln (1-x) - \frac{\sqrt{3}}{3} \tan ^{ - 1} \left( \frac{2x+1}{\sqrt{3}} \right) \right)
$$
from which I got 
$$
\frac{1}{3(1-x)} - \frac{1}{2(x^2 + x + 1)} - \frac{2x+1}{6x^2 + 6x + 6}
$$
However I can't seem to figure out the method or motivation for the fraction decomposition. I'm I missing something really obvious or am I missing a tool of integration?  Thank you very much for your help!
From the first answer suggesting completing the square I believe I was able to figure the rest out. One then gets a difference of squares and can then use a trigonometric substitution where 
$$ x + \frac{1}{2} = \frac{\sqrt{3}}{2} \tan \theta $$
the answer I got is 
$$
\frac{1}{3} \ln |x-1| - \frac{1}{6} \ln(x^2+x+1) - \frac{\sqrt{3}}{3} \tan ^{ - 1} \left( \frac{2x+1}{\sqrt{3}} \right) + C
$$
My last confusion is the discrepancy in the solutions. Wolfram's second term seems to be undefined over $ (1, \infty) $, whereas I believe that $$
\int  \frac{\mathrm{d}x}{x^3-1}
$$ should be defined over that interval.
 [/INST] Hint: Complete the square in the denominator: $x^2+x+1 = (x + 1/2)^2 + 3/4$. Now write the fraction as a linear combination of two fractions whose integral you can do.
</s>