$\tan(z)$ with residue theorem Calculate
$$\oint_{|z|=2}\tan(z)\,dz$$
because $\tan(z)=\dfrac{\sin(z)}{\cos(z)}$ the poles are when $\cos(z)=0$ 

at $z=\pm\pi/2\pm n\pi, \;n\in\mathbb{Z}$

Poles inside $|z|=2$ are $\pm\pi/2$ and are of first order. Can I know use the theorem for simple poles and just calculate the residuals
$$\operatorname{Res} \limits_{z=\pi/2} = \lim_{z\to \pi/2}(z-\pi/2)\frac{\sin(z)}{\cos(z)}$$
But I get stuck here. Hints?

OR
$$\cos (z)=1-\frac{z^2}{2!}+\frac{z^4}{4!}-\frac{z^6}{6!}\cdots $$
How do I know which coefficient to choose for the residual. Is it $1$ because the coefficient when $n=0$ is $1$ in the series? So the residuals for $\pm \pi/2$ are $1$.

So the integral is $2\pi i (1+1)=4\pi i$ ?
$\lim_{z \to \pi / 2} \dfrac{z - \pi/2}{\cos z} = \lim_{z \to \pi / 2} \dfrac{1}{\dfrac{\cos z- \cos \pi /2}{z - \pi/2}} = \dfrac{1}{\cos'(\pi/2)} = -\dfrac{1}{\sin(\pi / 2)} = -1$

and $\lim_{z \to \pi / 2} \sin z = 1$
Let $f(z) = \tan z=(\sin z)/(\cos z)$.
cos $z = o$  when $z= ±π/2 , ±3π/2 , ±5π/2,$...
These are the poles of the function $\tan z$
Among these  the two poles $z= ±π/2$ lie inside the circle $|z| = 2$.
Residue of $f(z)$ at  $π/2 = −1$ and Residue of $f(z)$ at $−π/2  = −1$.
By the Residue Theorem, we have
the answer to be $= 2πi \text {(sum of the residues )} = 2πi(-2)=−4πi.$