What is the integral of n-th root of tan x? What will be the value of
$ \int\sqrt[n]{\tan x},dx $
?
I have solved the cases for n=2 and n=3 but can't see how I can generalize it.
 A: As said in comments, this a quite difficult integral. However, if you change variable $x=\tan ^{-1}(y)$, you have $$\int\sqrt[n]{\tan x} dx=\int \frac {y^{1/n}} {1+y^2} dy =\frac{n y^{\frac{1}{n}+1} \, _2F_1\left(1,\frac{n+1}{2 n};\frac{1}{2}
   \left(3+\frac{1}{n}\right);-y^2\right)}{n+1}$$ which looks slightly better than in the original form for which you would have a lot of trouble for some specific values of $n$ ($5$,$7$,..).
This explains why, for $n=3$, you have (this could be significantly simplified with patience) $$\frac{1}{4} \left(-2 \sqrt{3} \tan ^{-1}\left(\sqrt{3}-2 \sqrt[3]{\tan
   (x)}\right)-2 \sqrt{3} \tan ^{-1}\left(2 \sqrt[3]{\tan
   (x)}+\sqrt{3}\right)-2 \log \left(\tan
   ^{\frac{2}{3}}(x)+1\right)+\log \left(\tan
   ^{\frac{2}{3}}(x)-\sqrt{3} \sqrt[3]{\tan (x)}+1\right)+\log
   \left(\tan ^{\frac{2}{3}}(x)+\sqrt{3} \sqrt[3]{\tan
   (x)}+1\right)\right)$$
Added later to this answer
If one makes a second change of variable $y=z^n$, he should arrive to a very nice integral which is $$n \int \frac {z^n}{1+z^{2n}} dz$$
A: The generalization is tedious but actually pretty straight forward. The key is perform partial fraction decomposition of some rational function in a systematic manner.  
Introduce variables $y$ and $z$ such that $y = \tan x = z^{n}$, we have
$$\int \sqrt[n]{\,\tan x} dx = \int \frac{y^{1/n}}{1+y^2} dy = \int \frac{n z^n}{1+z^{2n}} dz$$
For any integer $k$, let $\displaystyle\;\theta_k = \frac{(2k+1)\pi}{2n}\;$. We can factorize the denominator of the integrand as
$$z^{2n}+1 
= \prod_{k=0}^{n-1}\left(z- e^{i\theta_k}\right)\left(z - e^{-i\theta_k}\right)
= \prod_{k=0}^{n-1}\left(z^2 - 2\cos\theta_k z + 1\right)
$$
What make life easier is all the roots of the denominator are simple. Given any two polynomials $p(z)$ and $q(z)$
with $\deg p < \deg q$. If all the roots $\lambda_1, \lambda_2, \ldots, \lambda_{\deg q}$ of $q(z)$ are simple, we can read off the partial fraction decomposition of their quotient easily:
$$\frac{p(z)}{q(z)} = \sum_{k=1}^{\deg q} \frac{p(\lambda_k)}{q'(\lambda_k)(z - \lambda_k)}$$
Apply this to our integrand and notice $e^{in\theta_k} = (-1)^k i$, we can simplify $\displaystyle\;\frac{n z^n}{1+z^{2n}}\;$ as
$$\begin{align}
& n \sum_{k=0}^{n-1} \left[
  \frac{ e^{in\theta_k} }{2n e^{i(2n-1)\theta_k} (z - e^{i\theta_k} ) }
+ \frac{ e^{-in\theta_k} }{2n e^{-i(2n-1)\theta_k} (z - e^{-i\theta_k} ) }
\right]\\
=&
\frac{1}{2i}\sum_{k=0}^{n-1} (-1)^k 
\left[
\frac{e^{i\theta_k}}{z-e^{i\theta_k}} - 
\frac{e^{-i\theta_k}}{z-e^{-i\theta_k}}
\right]\\
=& \sum_{k=0}^{n-1} (-1)^k\sin\theta_k \left( \frac{z}{z^2 - 2\cos\theta_k z + 1}\right)\\
=& \sum_{k=0}^{n-1} (-1)^k\left[ \sin\theta_k \left(\frac{z - \cos\theta_k}{z^2 - 2\cos\theta_k z + 1}\right) + \cos\theta_k\left(\frac{\sin\theta_k}{(z - \cos\theta_k)^2 + (\sin\theta_k)^2}\right)\right]
\end{align}$$
and evaluate the indefinite integral as
$$\sum_{k=0}^{n-1}(-1)^k\left[
\frac{\sin\theta_k}{2}
\log\left(z^2 - 2\cos\theta_k z + 1\right)
+ \cos\theta_k
\arctan\left(\frac{z - \cos\theta_k}{\sin\theta_k}\right)
\right] + \text{const.}
$$
