A Tangent Integral $\int{\frac {1+\tan^2 (x)}{1+\tan^5 (x)}}dx$ What is the answer the following integral?
$$I=\int{\frac {1+\tan^2 (x)}{1+\tan^5 (x)}}dx$$
It is sufficient to factor the polynomial $x^5+1$.
 A: First use the substitution $u=\tan x$ to get
$$\begin{align}
I &= \int \frac{1}{u^5+1} du \\
\end{align} \tag{1}$$
Then you need to use partial fractions. This is a brutal step! 
First you should find the roots of
$$u^5+1=0 \tag{2}$$
which are
$$\begin{align}
u_1 &= (-1)^{\frac 15} = \alpha\\
u_2 &= (-1)^{\frac 35} = \beta\\
u_3 &= (-1)^{\frac 55} = -1 \\
u_4 &= (-1)^{\frac 75} = \beta^{*} \\
u_5 &= (-1)^{\frac 95} = \alpha^{*} 
\end{align} \tag{3}$$
where $*$ denotes the complex conjugate. Hence, by partial fraction decomposition we write
$$\frac{1}{x^5+1}=\prod_{i=1}^{5}\frac{1}{u-u_i}=\sum_{i=1}^{5}\frac{A_i}{u-u_i} \tag{4} $$
where you can simply find the coefficients $A_j$ by multiplying $(4)$ by $u-u_j$ and putting $u=u_j$
$$A_j= \left. \prod_{i=1}^{5} \frac{u-u_j}{u-u_i} \right|_{u=u_j} \tag{5}$$
Finally, using $(4)$ in $(1)$ we have
$$\begin{align}
I &= \int \frac{1}{u^5+1} du  
= \int \sum_{i=1}^{5}\frac{A_i}{u-u_i} du 
= \sum_{i=1}^{5} \int \frac{A_i}{u-u_i} du 
= \sum_{i=1}^{5} A_i \ln (u-u_i)
\end{align} \tag{6}$$
Notice that the result is expressed in terms of the complex valued Logarithm. 
We may not do the same if we want the final result to be in terms of real valued elementary functions of real variable. In fact, I factorized $u^5+1$ over $\Bbb{C}$ but if you factorize $u^5+1$ over $\Bbb{R}$ then you can have the final result in terms of real valued elementary functions but you may solve a little harder integrals to get the final answer. To get the factorization over $\Bbb{R}$, just multiply the corresponding factors to complex conjugate roots. You can also combine the corresponding complex valued logarithms to complex conjugate roots and do some function transformations to get a real valued function. For example, this link shows the final result that Mathematica obtained in terms of real valued elementary functions of real variable.
