<s>[INST] How can I solve $\int \frac{3x+2}{x^2+x+1}dx$ I want to compute this primitive $$I=\int \frac{3x+2}{x^2+x+1}dx.$$
I split this integral into two part:
$$\int \frac{3x+2}{x^2+x+1}dx=\int \frac{2x+1}{x^2+x+1}dx+\int \frac{x+1}{x^2+x+1}dx,$$
For the first part:
$$\int \frac{2x+1}{x^2+x+1}dx= \ln(|x^2+x+1|)+c_1$$
For the second part: due a change of variable $u=x+1$, I find
$$\int \frac{x+1}{x^2+x+1}dx= \int \frac{x+1}{x(x+1)+1}dx=\int \frac{u}{u(u-1)+1}dx=\dots$$
 [/INST] Here is one approach to the second integral:
$$\int \frac{x + 1}{ x^2 + x + 1} dx = \frac12 \left(\int \frac{2x + 1}{ x^2 + x + 1} dx + \int \frac{1}{x^2 + x + 1} dx\right)$$
The first integral is identical to the one you integrated. The second is $\arctan$, which can be seen after you complete the square.
$$\int \frac{1}{x^2 + x + 1} dx = \int \frac{1}{x^2 + x + (1/2)^2 - (1/2)^2 + 1} dx$$
$$\int \frac{1}{(x+1/2)^2 + 3/4} dx = \frac{4}{3} \int \frac{1}{\left( \frac{2x+1}{\sqrt 3}\right) + 1} dx = \frac{2}{\sqrt{3}} \int \frac{1}{u^2 + 1} du = \frac{2}{\sqrt{3}} \arctan \left( \frac{2x+1}{\sqrt{3}}\right) + C$$
Where we used the substitution $u = \frac{2x+1}{\sqrt{3}}$.
</s>