Give an example of a function with singularity at $0$ and whose contour integral is zero. Give an example of a function that has a singularity at $0$ and whose contour integral around the circle $|z|=1$ is zero. Explain briefly why.
Need help verifying my example.
Example:
$f(z) = \frac{\cos(z)}{z}$ 
For $\oint \frac{\cos(z)}{z}$,
we have a singularity at $0$. 
So the residue of $f$ at $z=0$ of order $1$ is:
Res($f(z),z=0$) $= \displaystyle{\lim_{z \rightarrow 0}} \frac{d}{dz} \cos(z) = \displaystyle{\lim_{z \rightarrow 0}}-\sin(z) = -\sin(0) = 0$.
The value of the integral in the positive direction:
$\Rightarrow 2\pi i(0) = 0$.
The function has one pole at $z=0$, so any closed contour integral around the origin, namely the circle $|z|=1$ is zero.
 A: Let $f(z)$ be represented by its Laurent series $f(z)=\sum_{n=-\infty}^\infty a_nz^n$ in the annulus $r<|z|<R$, where $r<1<R$.  
If $a_{-1}=0$, then we have
$$\begin{align}
\oint_{|z|=1}f(z)\,dz&=\oint_{|z|=1}\sum_{n=-\infty}^\infty a_nz^n\,dz\\\\
&=\sum_{n=-\infty}^\infty a_n\oint_{|z|=1}z^n\,dz\\\\
&=0
\end{align}$$
Therefore, any function whose Laurent series representation has $a_{-1}=0$, will suffice.  If $a_{-k}\ne 0$ for some $k\ge 2$, then $f(z)$ has a singularity at $0$.
A: All you need is a function $f$ holomorphic in $\mathbb C\setminus \{0\},$ with an isolated singularity at $0,$ such that $f$ has an antiderivative in $\mathbb C\setminus \{0\}.$ If you have this, then the integral of $f$ over any closed contour in $\mathbb C\setminus \{0\}$ is $0$ simply by the fundamental theorem of calculus.
An example is $f(z) = 1/z^2,$ which has the antiderivative $-1/z$ in $\mathbb C\setminus \{0\}.$
A: Your formula for the residue is wrong, should be no derivation there, its just $Res_0(f)=\lim\limits_{z\rightarrow 0}z\cdot f(z)$ for a singularity of first order. Alternative ways are using the fact that $\cos(z)=1+z^2/2+...$, therefore your function can be written as $\frac{1}{z}+...$ where the dots represent the remaining, non-fractional parts of the series. As the rest of the series is analytical and therefore holomorphic, it's contour integral is 0, so you just have the contour integral of $\frac{1}{z}$ left, which is $2\pi i$.
