The following is the graph of the $\tan(x)$ function:
We can clearly see there how it’s undefined at $\frac \pi 2$.
Now, what if we wanted to find the area between the tangent function and the x-axis in the interval $[0, 2]$?
The following happens:
$$\int \tan(x) dx = -\ln|\sec(x)| + c, \quad c\in\mathbb{R}$$
$$\implies \int_{0}^{2} \tan(x) = (-\ln|\sec(2)|) - (-\ln|\sec(0)|)$$
$$\implies (-\ln|\sec(2)|) - (-\ln(1)) = (-\ln|\sec(2)|) + \ln(1)$$
$$ |\sec(2)| = 2.40299796…$$
So what we end up getting is something in the form
$$\int_{0}^{2} \tan(x) dx = -\ln(2.40299..) + \ln(1)$$
Which ends up giving us
$$-0.87671710853 + 0$$
Which is definitely a finite value!
However, when you look at the above graph, you clearly see that there should be infinite area there, as the tangent is asymptotic one unit before there.
What’s going on here?