Indefinite Integral of ${\tan(x)}^{p/q}$ I have seen a lot of videos in which people integrate functions like $\sqrt{\tan(x)}$, $\sqrt[3]{\tan^2(x)}$, etc. I was wondering if there was a closed-form expression for
$$\int (\tan{x})^{\frac{p}{q}} dx$$
Where $p,q$ are integers, and $q \neq 0$. Eventually, I would like to generalize the result to an integrand ${\tan(x)}^r$, for $r \in \mathbb{R}$, but for now we can stay with the rationals.
My attempt at solving this:
Let $u = \tan(x) \implies x = \arctan(u), dx = \frac{du}{1+u^2}$. This yields
$$\int \frac{u^{\frac{p}{q}}}{1+u^2}du$$
But I'm not sure where to go from here. My first thought was long division, but that can't work here. I also considered treating $\frac{1}{1+u^2}$ like a geometric series, but that has a finite radius of convergence.

Here is a more general result. Let $a \in \mathbb{R}\backslash\left\{-1,-3\right\}$ and let the integral in question be $I$.  For this answer, we will suppose the following:
$$\cos^2(x) =\text{ } _2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right)-\frac{2\tan^2(x)}{3+a}\text{ }_2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right)$$
(which can be seen here (I have tried multiple real values of $a$)) where $\text{ } _2F_1 (a,b;c;z)$ is the Hypergeometric Function. Applying this, we get
$$
\eqalign{
I =& \int\tan^{a}\left(x\right)dx \cr
=& \int\frac{\tan^{a}\left(x\right)}{\cos^{2}\left(x\right)}\cos^{2}\left(x\right)dx \cr
=& \int\frac{\tan^{a}\left(x\right)}{\cos^{2}\left(x\right)}\text{ } _2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right)dx \cr
&- \frac{2}{3+a}\int\frac{\tan^{2+a}\left(x\right)}{\cos^{2}\left(x\right)}\text{ }_2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right) \cr
}
$$
Next, we will suppose
$$\frac{d}{dz} \text{ } _2F_1 (a,b;c;f(z)) = \frac{ab}{c}\text{ } _2F_1 (a+1,b+1;c+1;f(z))f'(z).$$
Integrating by parts on the first integral, we let $u =\text{ }_2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right)$ and $dv = \dfrac{\tan^{a}\left(x\right)}{\cos^{2}\left(x\right)}dx$ so that $du = -\dfrac{2+2a}{3+a} \text{ } _2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2}; -\tan^2(x)\right)\tan(x)\sec^2(x)$ and $v = \dfrac{\tan^{1+a}(x)}{1+a}$. Then
$$
\eqalign{
I =& \frac{\tan^{1+a}\left(x\right)}{1+a} \text{ }_2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right) \cr
&- \frac{1}{1+a}\int\tan^{1+a}\left(x\right)\left(-\frac{1+a}{3+a}\text{ } _2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right)\right)2\tan\left(x\right)\sec^{2}\left(x\right)dx \cr
&- \frac{2}{3+a}\int\frac{\tan^{2+a}\left(x\right)}{\cos^{2}\left(x\right)} \text{ } _2F_1\left(2, \frac{3+a}{2}; \frac{5+a}{2};-\tan^2(x)\right). \cr
}
$$
Therefore,
$$\int\tan^{a}\left(x\right)dx = \frac{\tan^{1+a}\left(x\right)}{1+a} \text{ }_2F_1\left(1, \frac{1+a}{2}; \frac{3+a}{2};-\tan^2(x)\right) + C.$$
