I have tried to use integration by parts taking $u$ as $\tan x$ and $v$ as $1$:
$$\int \tan x \,dx = \int \tan x \cdot 1\; dx = \tan x \cdot x - \int \sec^2 x \cdot x\; dx$$
then by taking $u$ as $x$ and $v$ as $\sec^2 x$:
$$\implies\int \tan x\;dx = x \cdot \tan x - \Bigg(x \cdot \tan x - \int 1\cdot \tan x\;dx \Bigg)$$
I have also tried taking $u$ as $\sec^2 x$, $v$ the other way around but that increased the complexity.
I'm actually trying to solve $I_n =\displaystyle\int^\frac\pi4_0 \tan^n x\;dx$ using reduction.
I have to show that for $n\geqslant 2$: $$I_n = \frac1{n-1}-I_{n-2}$$
I rewrote the equation to $I_n = \int \tan^{n-2}x\cdot \tan^2 x\;dx = \int \tan^{n-2} x(1-\sec^2 x)dx$
But when I integrate the term of $\int \tan^{n-2} x\cdot \sec^2 x\;dx$ I'm getting a $\frac10$ value:
$$\int \tan^{n-2} x\cdot \sec^2 x\;dx = \bigg[ \tan^{n-2} x\cdot \tan x\bigg]^\frac\pi4_0 - (n-2)\int \tan^{n-3}x\cdot \tan x\;dx$$ $$\implies I_n = I_{n-2}-\bigg( (1-\infty)-(n-2)I_{n-2}\bigg)$$
You should use anti-differentiation for this particular approach.
$$ \begin{align*} \int \tan x \,dx &= \int \frac {\sin x}{\cos x} \,dx \\&= -\int \frac {-\sin x}{\cos x} \,dx\,\,\, \spadesuit \\&= -\ln |\cos x| +C \end{align*} $$
At $\spadesuit$, it works because it utilizes the idea that $\frac{d}{dx} \ln f(x) = \frac{f'(x)}{f(x)}$.
Understand that in that example, $f(x) = \cos x$ and, by differentiating, $f'(x) = -\sin x$. Hence, with that form, just integrate. Note that $\ln$ can only take positive values. Hence, the $||$ modulus notation around the function.
Now, observe that
$$\tan^n x=\tan^{n-2}x \times \tan^2x =\tan^{n-2}x \times (\sec^2x-1)\,\,\,\forall \,x\geq2 \,\,\,\heartsuit$$
Consider that
$$ \begin{align*} \int \tan^n x \,dx &= \int \tan^{n-2}x \times (\sec^2x-1) \,dx \\&= \int \tan^{n-2}x \times (\sec^2x-1) \,dx\,\,\, \text{using} \, \heartsuit \\&= \int \tan^{n-2}x \times (\sec^2x) \,dx - \underbrace{\int \tan^{n-2}x \,dx}_{I_{n-2}} \end{align*} $$
You should be able to solve it from here.