<s>[INST] Integrating $\int \frac{x^2}{1+x^5} \, dx $ I just encountered the following integral 
$$\int \frac{x^2}{1+x^5} \, dx $$
At first it appeared to be simple, but I don't know how to solve it. Please share any ideas.
 [/INST] In this problem, the hard part is the algebra.
\begin{align}
x^5 + 1 & = (x+1)(x^4-x^3+x^2-x+1) \\[10pt]
& = (x+1)\left(x^2 - 2x\cos\frac\pi5 + 1\right)\left(x^2 - 2x\cos\frac{3\pi}5 + 1\right)
\end{align}
These two quadratic factors are irreducible, as can be seen by the fact that their discriminants are negative.
Next, proceed to partial fractions.  Completing the square, you get
\begin{align}
x^2 -2x\cos\frac\pi 5 +1 & =\left( x^2 - 2x\cos\frac\pi 5 + \cos^2\frac\pi5\right) + \sin^2 \frac\pi5 \\[10pt]
& = \left( x - \cos\frac\pi5 \right)^2 +\sin^2\frac\pi 5.
\end{align}
If you have $\dfrac{Ax+B}{\left( x - \cos\frac\pi5 \right)^2 +\sin^2\frac\pi 5} \, dx$, you can write it as
\begin{align}
& \frac{A\left(x-\cos\frac\pi5\right)}{\left( x - \cos\frac\pi5 \right)^2 +\sin^2\frac\pi 5}\,dx + \frac{B + A\cos\frac\pi 5}{\left( x - \cos\frac\pi5 \right)^2 +\sin^2\frac\pi 5}\,dx \\[10pt]
= {} & \frac{\frac 1 2\,du}{u} + \frac{B + A\cos\frac\pi 5}{\left( x - \cos\frac\pi5 \right)^2 +\sin^2\frac\pi 5}\,dx
\end{align}
The first term yields a logarithm and the second an arctangent.
Moral: In this probelm, the hard part is the algebra.
So how did I get $\pi/5$ and $3\pi/5$?
The point is that $x^5+1=0$ iff $x^5 = -1$, and the $5$th roots of $-1$ are $\cos\dfrac\pi5 + i\sin\dfrac\pi 5$ and other points on the circle differing from that by a fifth of a circle, i.e. $2\pi/5$ radians.  One of those points is $-1$, and that's where $(x+1)$ came from.  Two of those points are $\cos\frac\pi5 \pm i\sin\frac\pi5$, and two are $\cos\frac {3\pi}5\pm i\sin\frac{3\pi}5$.  So
$$
\left(x - \cos\frac\pi 5 - i \sin\frac\pi5\right)\left(x - \cos\frac\pi 5 + i \sin\frac\pi5\right) = \left(x^2 - 2x\cos\frac\pi5+1\right).
$$
</s>