How to find the residue of a pole? I am trying to integrate the function 
$f(z)=\frac{z}{1-\cos z}$ inside the unit circle.
I found the only singular point inside the unit circle to be $z=0$ since $\cos(x+iy)=1\Leftrightarrow y=0,x=2 \pi n$ is this correct way in doing this?
I also found out that this singular point is a pole because
$\lim \limits_{z \to 0}f(z)$ does not exist but $\lim \limits_{z \to 0}\frac{1}{f(z)}$ does exist thus $z=0$ is a pole of $f(z)$.
How can I now proceed to find the residue at this point? 
 A: There is a general formula to calculate the residue of a pole of the order of $m$ at $a\in\mathbb{C}, a\neq\infty$:
$$\mathrm{res}\,f(a)= \frac{1}{(m-1)!}\lim_{z\to a}\left(\frac{d^{m-1}}{dz^{m-1}}(z-a)^m f(z)\right)$$
So here $m=1$ and $a=0$, thus
$$\mathrm{res}\,f(0) = \lim_{z\to0}\frac{z^2}{1-\cos{z}}$$
This can be solved on the real axis (it does not matter how $z$ approaches $0$) by using L'Hôpital's rule twice. The result is
$$\mathrm{res}\,f(0)=2$$
A: First, if you're trying to use the residue theorem, you are taking the line integral around the unit circle, not inside the unit circle.  The residue theorem allows you to evaluate a line integral around a closed curve by computing residues inside the curve.
Yes, you are correct, the only place where the denominator vanishes is when $\cos(z)=1$.  We can see this because $\cos(x+iy)=\cos(x)\cosh(y)-i\sin(x)\sinh(y)$.  For the imaginary part to be $0$, either $\sin(x)=0$ or $\sinh(y)=0$.  The first equals zero (within the unit circle) when $x=0$ and the second equals zero only when $y=0$.  When $x=0$, $\cos(x)=1$, so we need $\cosh(y)=1$, which happens only when $y=0$.  On the other hand, when $y=0$, $\cosh(y)=1$, so we need $\cos(x)=1$, which only happens (within the unit circle) when $x=0$.  Therefore, the only places where the denominator vanishes within the unit circle is when $z=0$.  
Therefore, the line integral
$$
\int_{S^1}\frac{z}{1-\cos(z)}dz=2\pi i\operatorname{Res}_f(0).
$$
To get the residue, we need to figure out the power series expansion of the integrand (and, in particular, the coefficient of the $z^{-1}$ in the Laurent power series expansion).  Since the power series expansion for $\cos(z)$ is
$$
\cos(z)=1-\frac{z^2}{2}+O(z^4).
$$
Therefore,
$$
1-\cos(z)=\frac{z^2}{2}+O(z^4).
$$
Therefore, 
$$
\frac{1}{1-\cos(z)}=\frac{1}{z^2\left(\frac{1}{2}+O(z^2)\right)}.
$$
For $z$ close to zero, the error term vanishes (or alternately, the factor is analytic and nonzero near $0$, so its inverse has a power series expansion with no negative powers of $z$), and we have that the first term of the Laurent polynomial is $\frac{2}{z^2}$.  Multiplying this by $z$ gives $\frac{2}{z}$, so the residue is $2$.
