I want to evaluate this integral
$$ I = \int_c \tan z + \frac{\csc z}{z} dz $$ $$ c :|z| = 1 $$
apparently tanz is analytic in this region so its integral equals to zero now $$ I = \int_c\frac{\csc z}{z} dz $$ okay I did the following
$$ \frac{\csc z}{z} = \frac{1}{z\sin z} =\frac{1}{z(z-\frac{z^3}{3!}+\frac{z^5}{5!}-\cdots)} $$
$$ \frac{\csc z}{z} = \frac{1}{z^2(1-\frac{z^2}{3!}+\frac{z^4}{5!}-\cdots)} $$
letting $$ g(z) = \frac{1}{(1-\frac{z^2}{3!}+\frac{z^4}{5!}-\cdots)} $$ then
$$ \frac{\csc z}{z} = \frac{g(z)}{z^2} $$
$$ I = \int_c\frac{\csc z}{z} dz = \int_c\frac{g(z)}{z^2} dz $$
using cauchy's integral formula for derivatives $$ \int_c\frac{g(z)}{z^2} dz = \frac{2\pi i }{1!} g'(0) $$
well $$ g'(0) = 0 $$ and the whole integral equals to zero this means the function is analytic which doesn't seem to be true did I make a mistake?
First of all, $\tan$ is only analytic away from its poles, but there aren't any inside the unit circle. Second, you would need to know $\int_C g(z)\,dz=0$ with $g$ continuous and for all circles $C$ to conclude $g$ is analytic.
One shortcut for you: $(\csc z)/z$ is an even function, so, without computation, its residue at $0$ must be $0$.