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. 

We first decrease the power 2 using integration by parts.
$$\begin{aligned} \int \frac{d x}{\left(1+x^{4}\right)^{2}} &=-\frac{1}{4}\int \frac{1}{x^{3}} d\left(\frac{1}{1+x^{4}}\right) \\ &=-\frac{1}{4}\left[\frac{1}{x^{3}\left(1+x^{4}\right)}+3 \int \frac{d x}{x^{4}\left(1+x^{4}\right)}\right] \\ &=-\frac{1}{4}\left[\frac{1}{x^{3}\left(1+x^{4}\right)}-\frac{1}{x^{3}}-3\int \frac{d x}{1+x^{4}}\right] \\ &=\frac{x}{4\left(1+x^{4}\right)}+\frac{3}{4} \int \frac{d x}{1+x^{4}} \end{aligned}$$
By my post,
$$\int \frac { d x } { x ^ { 4 } + 1 }   =  \frac { 1 } { 4 \sqrt { 2 } } \left[ 2 \tan ^ { - 1 } \left( \frac { x ^ { 2 } - 1 } { \sqrt { 2 } x } \right) + \ln \left| \frac { x ^ { 2 } + \sqrt { 2 } x + 1 } { x ^ { 2 } - \sqrt { 2 } x + 1 } \right|\right] + C,$$
we  get$$
\int \frac{d x}{\left(1+x^{4}\right)^{2}}=\frac{x}{4\left(1+x^{4}\right)}+\frac{3}{16 \sqrt{2}}\left[2 \tan ^{-1}\left(\frac{x^{2}-1}{\sqrt{2} x}\right)+\ln \left|\frac{x^{2}+\sqrt{2} x+1}{x^{2}-\sqrt{2} x+1}\right|\right]+C
$$
