The residue of $$f(z)=\tan{z}$$ at any of its pole is,
$$f(z)=\tan{z}=\frac{(z-\frac{\pi}{2})(\tan{z})}{(z-\frac{\pi}{2})}$$
$$\begin{align}
\left({\operatorname{Res} {f(z)=\tan{z}; z=\frac{\pi}{2}}}\right)&=\lim_{z\to \large{\frac{\pi}{2}}}\left((z-\frac{\pi}{2})(\tan{z})\right)\\
\\
&=0\\
\end{align}$$
Best Answer
$$\tan z = \frac{\sin z}{ \cos z}$$
$$\lim_{z \to \frac{\pi}{2}} \left(z- \frac{\pi}{2} \right)\frac{\sin z}{ \cos z} = \frac{\sin \left(\frac{\pi}{2} \right)}{ - \sin \left(\frac{\pi}{2} \right)}=-1$$
where
$$f'(z_0) =\lim_{z \to z_0}\frac{f(z)-f(z_0)}{z-z_0}$$
$z_0 =\frac{\pi}{2}$ ,$f = \cos(z)$