Better way of finding $\int {x^2 + 1 \over x^4 + x^2 + 1} dx$. 
$$\int {x^2 +  1 \over x^4 + x^2 + 1} dx$$


By separating partial fractions, 
$${Ax + B \over x^2 - x + 1}  + {Cx + D \over x^2 + x + 1}  = {x^2 + 1 \over x^4 + x^2 + 1} \\ \implies (Ax + B)(x^2 + x + 1) + (Cx + D)(x^2 - x + 1) = x^2 + 1$$
I get $$\begin{cases} A = -1/2 \\ 
 B = 1/2\\
 C = 1/2 \\
D = 1/2\end{cases}$$
For which the integrand becomes 
$${1 \over 2}\int {1 - x\over x^2 - x + 1} dx + {1\over2} \int {x + 1\over x^2 + x + 1} dx$$
Now these two are easy enough to solve but still very tedious, not to mention that partial fractions was also very tedious.
Is there a  less cumbersome way to solve this ? I tried to change the integrand of form $1 + 1/x^2$ so that I substitute $u = 1 - 1/x$ but was unsuccessful .     
 A: Note
$$ \int {x^2 +  1 \over x^4 + x^2 + 1} dx=\int {1+\frac1{x^2} \over x^2 + \frac1{x^2} + 1} dx=\int\frac{1}{(x-\frac1x)^2+3}d(x-\frac1x).$$
Now letting $u=x-\frac1x$, you can easily solve the problem
A: Here is a funny way that I noticed by chance. I don't see really why it would work, it popped out when I played with the function. In any case, I think someone might get something out of it, so I post it.
We first notice that
$$
\frac{1+x^2}{1+x^2+x^4}-\frac{a}{b+x^2}=\frac{b-a+(1+b-a)x^2+(1-a)x^4}{b+(1+b)x^2+(1+b)x^4+x^6}
$$
If we choose $b=3$ then the denominator becomes
$$
3+(2x+x^3)^2,
$$
and the right-hand side becomes
$$
\frac{3-a+(4-a)x^2+(1-a)x^4}{3+(2x+x^3)^2}
$$
If we next choose $a=1$ the numerator magically becomes the derivative of $2x+x^3$! 
Thus, we conclude that
$$
\begin{aligned}
\int\frac{1+x^2}{1+x^2+x^4}\,dx
&=\int\Bigl(\frac{1}{3+x^2}+\frac{2+3x^2}{3+(2x+x^3)^2}\Bigr)\,dx\\
&=\frac{1}{\sqrt{3}}\Bigl(\arctan\frac{x}{\sqrt{3}}+\arctan\frac{2x+x^3}{\sqrt{3}}\Bigr)+C.
\end{aligned}
$$
A: Another way is to perform the awkward substitution $x=\frac{-\sqrt{3}+\sqrt{3+4t^2}}{2t}$ to simply get $\int\frac{dt}{\sqrt{3}(1+t^2)}$, but of course this approach just follows from reverse-engineering the straightforward solution through partial fraction decomposition.
A: Notice that if you plug $x=i$ into $$(Ax+B)(x^2+x+1)+(Cx+D)(x^2-x+1)=x^2+1$$
You get $$Bi-A+C-Di=(C-A)+(B-D)i=0$$
or $C=A,B=D$ so
$$(Ax+B)(x^2+x+1+x^2-x+1)=2(Ax+B)(x^2+1)=x^2+1$$
From this it's easy to see that $A=C=0$ and $B=D=1/2$
