Integrate $\int \frac{1}{1+x+x^4}dx$ 
Find $$\int \frac{{\rm d}x}{1+x+x^4}.$$

WA gives a result, which introduces complex numbers. But according to the algebraic fundamental theorem, any rational fraction can be integrated over the real number field. 
How to do this?
 A: Yow-Zooey!  This is a horrendously difficult function to work with!  Are you sure there is not a typographical error somewhere?
The best way to identify a real quadratic factorization is to use a resolvent cubic.  Assume a factorization having the form
$x^4+x+1=(x^2-s^{1/2}x+t_1)(x^2+s^{1/2}x+t_2)$
where $s$ is to be real and nonnegative in a real factorization.  The fourth and third degree terms match trivially.  Now match the quadratic and linear terms:
$x^2\to t_1+t_2-s=0, t_1+t_2=s$  eq. 1
$x^1\to t_1-t_2=1/s^{1/2}$  eq. 2
We then have a linear system for $t_1,t_2$ in terms of $s$.  Solving by the usual methods for such a system leads to everything being rendered in terms of $s$:
$t_1=\dfrac{s^2+s^{1/2}}{2s}$
$t_2=\dfrac{s^2-s^{1/2}}{2s}$
So our quadratic factorization will be
$x^4+x+1=(x^2-s^{1/2}x+\dfrac{s^2+s^{1/2}}{2s})(x^2+s^{1/2}x+\dfrac{s^2-s^{1/2}}{2s})$  eq. 3
Now we have to find $s$.  To get that we have to match the constant terms:
$t_1t_2=(1/4)(t_1+t_2)^2-(1/4)(t_1-t_2)^2=1$
Substitute for $t_1\pm t_2$ from eqs. 1 and 2 and clear fractions leading to the cubic equation
$s^3-4s-1=0$ 
All the complexity in the roots given from another answer arise from solving this irreducible cubic equation, but we do guarantee one real, positive root from Descartes' Rule of Signs.  In practice you would probably have to approximate this root numerically; $s\approx 2.1149$.  An exact rendering for $s$ in terms of real functions requires using trigonometric functions:
$s=\sqrt{16/3}\cos(\frac13\cos^{-1}\sqrt{27/256})$
Plug this root into eq. 3 and integrate by methods appropriate when the denominator is a product of two distinct quadratic polynomials.
A: Factorize
$$x^4 +x+ 1= \left(x^2+ax+\frac{a^3-1}{2a}\right)\left(x^2-ax+\frac{a^3+1}{2a}\right)$$
where $a$ satisfies $a^6-4a^2-1=0$, or
$$a=\frac2{\sqrt[4]3}\sqrt{\cos\left(
\frac13\cos^{-1}\frac{3\sqrt3}{16} \right)}
$$
Then, decompose the integrand
$$\frac1{1+x+x^4}
= \frac a{2a^6+1} \bigg(\frac{2a^2x+2a^3+1}{x^2+ax+\frac{a^3-1}{2a}}
-\frac{2a^2x-2a^3+1}{x^2-ax+\frac{a^3+1}{2a}} \bigg)$$
and integrate
\begin{align}
&\int \frac{dx}{1+x+x^4}\\
=&\ \frac a{2a^6+1} \int \bigg(\frac{a^2(2x+a)+ a^3+1}{x^2+ax+\frac{a^3-1}{2a}}
-\frac{a^2(2x-a)-a^3+1}{x^2-ax+\frac{a^3+1}{2a}} \bigg)dx\\
=&\ \frac {a^{3/2}}{a^6+\frac12} \bigg( 
\frac {a^3+1}{\sqrt{a^3-2}}\tan^{-1}\frac{\sqrt a(2x+a)}{\sqrt{a^3-2}}
+\frac {a^3-1}{\sqrt{a^3+2}}\tan^{-1}\frac{\sqrt a(2x-a)}{\sqrt{a^3+2}}\\
&\hspace{20mm} + \frac{a^{3/2}}2\ln \frac{x^2+ax+\frac{a^3-1}{2a}}{x^2-ax+\frac{a^3+1}{2a}}  \bigg)+C
\end{align}
A: One approach, although tedious, will lead to a fractional decomposition, from which the integral can be calculated easily without using complex variables. It is easy to check that the function $f(x)=1+x+x^4$ is not a perfect square and has no real roots ($f$ has a positive  global minimum at $x=-1/\sqrt[3]{4}$). This means that 
$f(x)=(ax^2+bx+c)(ux^2+vx+w)$ with $b^2-4ac<0$ and $v^2-4uw<0$. 
Expand this, equate coefficients to solve for $a,b,c,u,v,w$. Then, decompose as usual: there are real numbers $A,B,C,D$ such that 
$\displaystyle\int \frac{1}{1+x+x^4}dx=\int \frac{Ax+B}{ax^2+bx+c}dx+\frac{Cx+D}{ux^2+vx+w}dx$
whose antiderivatives are logartithms and inverse tangents. 
A: Why did you have to choose this rational function... ? Well there is a factorization like this: 
$$1+x+x^4=\left(x^2-\sqrt{\frac{\sqrt[3]{\frac{1}{2} \left(9+i
   \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2} \left(9+i \sqrt{687}\right)}}}
   x+\frac{1}{2} \left(\frac{\sqrt[3]{\frac{1}{2} \left(9+i
   \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2} \left(9+i \sqrt{687}\right)}}-4
   \sqrt{\frac{\sqrt[3]{\frac{1}{2} \left(9+i \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2}
   \left(9+i \sqrt{687}\right)}}}+\left(\frac{\sqrt[3]{\frac{1}{2} \left(9+i
   \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2} \left(9+i
   \sqrt{687}\right)}}\right)^{5/2}\right)\right) \left(x^2+\sqrt{\frac{\sqrt[3]{\frac{1}{2} \left(9+i
   \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2} \left(9+i \sqrt{687}\right)}}}
   x+\frac{1}{2} \left(\frac{\sqrt[3]{\frac{1}{2} \left(9+i
   \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2} \left(9+i \sqrt{687}\right)}}+4
   \sqrt{\frac{\sqrt[3]{\frac{1}{2} \left(9+i \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2}
   \left(9+i \sqrt{687}\right)}}}-\left(\frac{\sqrt[3]{\frac{1}{2} \left(9+i
   \sqrt{687}\right)}}{3^{2/3}}+\frac{4}{\sqrt[3]{\frac{3}{2} \left(9+i
   \sqrt{687}\right)}}\right)^{5/2}\right)\right)$$
(you can check that, even though $i$ is used in the construction of the coefficients, they are actually all real.)
A: \begin{align} 
\int \frac{{\rm d}x}{1+x+x^4}
\end{align} 
It looks like the main problem is factorization
of the quartic, so here it is one more variant:
for
\begin{align}
a&=\sqrt{\frac1{\sqrt3}\,\cos\Big(\tfrac13\,\arctan(\tfrac19\,\sqrt{687})\Big)}
\\
&\approx 0.72713608449
,
\end{align}
\begin{align}
x^4+x+1&=
\Big(x^2-2\,a\,x+2\,a^2+\sqrt{4\,a^4-1}\Big)
\left(x^2+2\,a\,x+\frac1{2\,a^2+\sqrt{4\,a^4-1})}\right)
\\
&\approx
(x^2-1.45427216898\,x+1.40126836794)
(x^2+1.45427216898\,x+0.713639173537)
.
\end{align}
