How to integrate $\tan(x)^n$? First, did use wolfram alpha and it does give me the answer in terms of a hypergeometric sequence.
I am a grade 12 student, and I am trying to investigate into this integral for my assessment.
Could someone please explain how I can go from the LHS to the RHS: 
$$\int \tan^n(x)\, dx = \frac {\tan^{n + 1}(x)\; _2F_1(1, \frac {n + 1}2, \frac {n + 3}2, -\tan^2(x))}{n + 1}\, + \,\text {constant}$$
Where, as usual, $_2F_1$ denotes the HyperGeometric Function
 A: Notice that $$(\tan x)'=\tan^2x+1$$ so that
$$\tan^n x=\tan^{n-2} x\,(\tan x)'-\tan^{n-2}x.$$
This gives you a recurrence relation that ends with the integrand $\tan x$ or $1$ depending on the parity of $n$.
$$I_n=\frac{\tan^{n-1}x}{n-1}-I_{n-2}.$$

This leads to better expressions than those given by Alpha, even with a numerical exponent.
E.g. 
https://www.wolframalpha.com/input/?i=integrate+tan%5E8x
versus
$$\frac{\tan^7 x}7-\frac{\tan^5 x}5+\frac{\tan^3 x}3-\tan x+x.$$
A: Depending on the limits, the Beta function can be used:
$$B(m+1,n+1)=2\int_0^{\pi/2}\cos^{2m+1}(x)\sin^{2n+1}(x)dx=\frac{m!n!}{(m+n+1)!}$$
For outside of this range you can use that:
$$B(z;a,b)=\int_0^zx^{a-1}(1-x)^{b-1}dx=z^a\sum_{n=0}^\infty\frac{(1-b)_n}{n!(a+n)}z^n$$
All this can be found here:
http://mathworld.wolfram.com/BetaFunction.html
http://mathworld.wolfram.com/IncompleteBetaFunction.html
A: Let's consider the case when $n=2k+1$ is odd: we can write
$$
\int\tan^nx\,dx=\int\tan^{2k+1}x\,dx=
\int\frac{(\sin^2x)^k}{\cos^{2k+1}x}\sin x\,dx=
-\int\frac{(1-\cos^2x)^k}{\cos^{2k+1}x}\,d(\cos x)
$$
which is elementary. Example with $k=2$: we reduce to
\begin{align}
-\int\frac{(1-\cos^2x)^2}{\cos^5x}\,d(\cos x)
&=-\int\left(\frac{1}{\cos^5x}-\frac{2}{\cos^3x}+\frac{1}{\cos x}\right)\,d(\cos x)\\
&=\frac{1}{4\cos^4x}-\frac{1}{\cos^2x}-\log\lvert\cos x\rvert+c
\end{align}
For $n=2k$ even, it's a bit different:
$$
\int\tan^nx\,dx=\int\frac{\sin^{2k}x}{\cos^{2k}x}\,dx=
\int\frac{(1-\cos^2x)^k}{\cos^{2k}x}\,dx
$$
and the problem is reduced to computing
$$
\int\frac{1}{\cos^{2m}x}\,dx
$$
which can be dealt with the substitution $t=\tan x$. Example with $m=2$; since
$$
\cos^2x=\frac{1}{1+\tan^2x}
$$
we have
$$
\int\frac{1}{\cos^4x}=\Bigl[t=\tan x,dt=\frac{1}{\cos^2x}\,dx\Bigr]=
\int(1+t^2)\,dt=t+\frac{t^3}{3}+c=\tan x+\frac{1}{3}\tan^3x\,dx
$$
In general, for $m\ge1$, with the same substitution,
$$
\int\frac{1}{\cos^{2m}x}=\int(1+t^2)^{m-1}\,dt
$$
