I'm trying to find the nature of the point $z=\pi/2$ for $f(z)=\tan^2z$ (e.g if it's regular, an essential singularity, a pole of degree n). I sought help from this similar post and what I essentially shown is that: $$ \tan^2 z = \left(\dfrac{\sin z}{\cos z}\right)^2 = \left(\dfrac{\cos(z-\pi/2)}{\sin(z-\pi/2)}\right)^2 = \left(\dfrac{1}{z-\pi/2}\dfrac{z-\pi/2}{\sin(z-\pi/2)}\cos(z-\pi/2) \right)^2 $$ Now, if I understand correctly then showing $\lim_{z\rightarrow\pi/2}(z-\pi/2)\tan^2z$ is finite would allow me to deduce that the pole is singular. From my above expansion, it's clear that this limit would not converge since I still have a remaining $1/(z-\pi/2)$ term that will blow up.
However, I can see how $\lim_{z\rightarrow\pi/2}(z-\pi/2)^2\tan^2z$ would converge instead, and this suggests that I have a pole of degree 2.
My problem with this is that I could have chosen an arbitrarily high $n$ such that $\lim_{z\rightarrow\pi/2}(z-\pi/2)^n\tan^2z$ would converge (e.g if I decided to guess $n=5$, then would I have claimed that the pole is of degree 5)? How do I know that I actually have a pole of degree 2? Isn't it possible that I just did not rewrite $f(z)$ correctly such that the $1/(z-\pi/2)$ cancels out?
The order of a pole(if it has finite order)$z_0$ is the unique number $n$ such that $(z-z_0)^n f(z)$ is holomorphic non-zero in a neighbourhood of $z_0$(uniqueness follows from the analyticity property).
With this in mind, one easily sees that for this $n$ we must have $\lim_{z\to z_0} (z-z_0)^n f(z) \neq 0$ and exists. Thus, locating any one such $n$ suffices, since that must be the order of the pole. We have located $n=2$ by checking the limit exists and is non-zero. Now, for $n<2$ the limit will be infinite, and for $n>2$ the limit will be $0$ (just by comparison/domination arguments, product of limit etc.), so these cases become trivial.
EDIT : In the above case, one sees that $$ \lim_{z \to \frac{\pi}{2}} \left(z - \frac \pi 2\right)^2 \tan^2 z =\lim_{z \to \pi/2} \sin^2 z \lim_{z \to \pi/2} \frac{(z-\pi/2)^2}{\cos^2 z} = 1 $$
Therefore, for all $k>2$, we have $\lim_{z \to \frac{\pi}{2}}\left(z - \frac \pi 2\right)^2 \tan^2 z = 0$ and for $k=1$ we have $\lim_{z \to \frac{\pi}{2}}\left(z - \frac \pi 2\right)^2 \tan^2 z = +\infty$, and the pole of order $2$.