Let us first consider Part (ii).
As the only singularity of the function $f(z)$ is at $z = 3$, any integral over a closed curve that does not contain the point $z = 3$ is just $0$, as there are no singularities contained within the curve.
Therefore, $\oint_C f(z)dz = 0$ for any closed curve $C$ that doesn't contain the point $z = 3$.
Now we consider Part (i), where $z = 3$ is contained within the curve. Here, one must evaluate the Residue of $f(z)$ the point $z = 3$.
The Residue is easily evaluated, as we only have to deal with a simple pole. It is given by: $$\text{Res}_3 f(z) = 2\pi i\lim\limits_{z \rightarrow 3}{(z - 3)f(z)} = 2\pi i$$
Thus, in this case, $\oint_C f(z)dz = 2\pi i$, if I haven't made any mistakes (no guarantees there, I'm pretty new to Residue Calculus myself).
We need to prove that differentiation under the integral is permissible. To do so, we will estimate the difference between the difference quotient, $\frac{f(a+\Delta z)-f(a)}{\Delta z}$,and the result we obtain from differentiating under the integral, $\frac{1}{2\pi i}\oint_C \frac{f(z)}{(z-a)^2}\,dz$.
We begin with Cauchy's Integral formula. If $f$ is analytic, then
$$f(a)=\frac{1}{2\pi i}\oint_C \frac{f(z)}{z-a}\,dz \tag 1$$
We will show now that $f'(a)=\frac1{2\pi i}\oint_C\frac{f(z)}{(z-a)^2}\,dz$.
From $(1)$, we find that
$$\begin{align}
\left|\underbrace{\frac{f(a+\Delta z)-f(a)}{\Delta z}}_{\to f'(a)\,\,\text{if the limit exists}}-\underbrace{\frac{1}{2\pi i}\oint_C \frac{f(z)}{(z-a)^2}\,dz}_{\text{Differentiating under the integral}}\right|&=\left|\frac{\Delta z}{(2\pi i)}\oint_C \frac{f(z)}{(z-a-\Delta z)(z-a)^2}\,dz\right|\\\\
&\le \frac{|\Delta z|}{2\pi}\oint_C \frac{|f(z)|}{|z-a|^2|z-a-\Delta z|}\,|dz|
\end{align}$$
Since $f$ is continuous, it is bounded by say $B$. Hence, $|f(z)|\le B$ for $z\in C$.
Denote $L$ to be the length of the contour $C$ and denote $r$ to be the shortest distance between $a$ and any point on $C$.
We take $|\Delta z|<r$. Using the estimates $|z-a|\ge r$ and from the triangle inequality $|z-a-\Delta z|\ge ||z-a|-|\Delta z||\ge r-|\Delta z|$ reveals
$$\begin{align}
\left|\frac{f(a+\Delta z)-f(a)}{\Delta z}-\frac{1}{2\pi i}\oint_C \frac{f(z)}{(z-a)^2}\,dz\right|&\le \frac{|\Delta z|BL}{2\pi r^2(r-|\Delta z|)}\to 0\,\,\text{as}\,\,\Delta z\to 0
\end{align}$$
Therefore, we have proven that
$$f'(a)=\frac1{2\pi i}\oint_C\frac{f(z)}{(z-a)^2}\,dz$$
and therefore
$$\begin{align}
f'(a)&=\lim_{\Delta z\to 0}\frac{f(a+\Delta z)-f(a)}{\Delta z}\\\\
&=\lim_{\Delta z\to 0}\frac{1}{2\pi i}\oint_C\frac{f(z)}{(z-a)(z-a-\Delta z)}\,dz\\\\
&=\frac{1}{2\pi i}\oint_C \lim_{\Delta z\to 0}\left(\frac{f(z)}{(z-a)(z-a-\Delta z)}\right)\,dz\\\\
&=\frac{1}{2\pi i}\oint_C\frac{f(z)}{(z-a)^2}\,dz
\end{align}$$
Best Answer
This is just Cauchy's theorem. When there's no singularity within the contour, the integrand is holomorphic, and the theorem says that the integral is zero.