<s>[INST] Integral with binomial to a power $\int\frac{1}{(x^4+1)^2}dx$ I have to solve the following integral:
$$\int\frac{1}{(x^4+1)^2}dx$$
I tried expanding it and then by partial fractions but I ended with a ton of terms and messed up. I also tried getting the roots of the binomial for the partial fractions but I got complex roots and got stuck. Is there a trick for this kind of integral or some kind of helpful substitution? Thanks. 
EDIT:
I did the following:
Let $x^2=\tan\theta$, then $x = \sqrt{\tan\theta}$ and $dx=\frac{\sec^2\theta}{2x}d\theta$ 
Then:
$$I=\int\frac{1}{(x^4+1)^2}dx = \int\frac{1}{(\tan^2\theta+1)^2} \frac{\sec^2\theta}{2x}d\theta=\int\frac{1}{\sec^4\theta} \frac{\sec^2\theta}{2x}d\theta$$
$$I=\frac{1}{2}\int{\frac{1}{\sec^2\theta \sqrt{\tan\theta}}}d\theta$$.
After this I don't know how to proceed. 
 [/INST] Use $\left(\frac x{x^4+1}\right)' = -\frac3{x^4+1} + \frac 4{(x^4+1)^2} $ to rewrite the integral as
$$I = \int \frac 1{(x^4+1)^2}dx=\frac x{4(x^4+1)}+\frac34\int\frac1{x^4+1} dx$$
where
\begin{align}\int\frac2{x^4+1} dx = &\int\frac{1+x^2}{x^4+1} dx + \int\frac{1-x^2}{x^4+1} dx\\
= &
\int\frac{d(x-\frac1{x})}{(x-\frac1{x})^2+2}  - \int\frac{d(x+\frac1{x})}{(x+\frac1{x})^2-2}\\
=&\ \frac1{\sqrt2} \tan^{-1}\frac{x^2-1}{\sqrt2x} + \frac1{\sqrt2} \coth^{-1}\frac{x^2+1}{\sqrt2x} 
\end{align}
Thus
$$I = \frac x{4(x^4+1)}+\frac3{8\sqrt2} \tan^{-1}\frac{x^2-1}{\sqrt2x} + \frac3{8\sqrt2} \coth^{-1}\frac{x^2+1}{\sqrt2x} + C$$
</s>