Calculate the integral of $g(z)$ along the closed path $|z-i|=2$ in the positive direction when
i)$g(z)=\frac{1}{z^2+4}$
ii)$g(z)=\frac{1}{(z^2+4)^2}$
First I checked the described area
$$|z-i|=2\rightarrow |x+iy-i|=2\rightarrow|(x-0)+i(y-1)|=2$$ Which is a circle with center $C(0,1)$ and $r=2$.But I'm having trouble calculating the integral
$\int_C \frac{1}{z^2+4}dz=\int_C \frac{1}{(z-2)^2+4z}dz$
And I tried to apply the formula derived in the analytical function, but is not going well
The circle $|z-i|=2$ can be parametrized by $$ z=2\cos(t)+i(1+2\sin(t)) $$ The first integral is then $$ \int_0^{2\pi}\frac{\overbrace{(-2\sin(t)+i2\cos(t))\,\mathrm{d}t}^{\large\mathrm{d}z}}{\underbrace{(4\cos^2(t)+3-4\sin(t)-4\sin^2(t))+i(4\cos(t)+8\sin(t)\cos(t))}_{\large z^2+4}} $$ This is pretty complicated, but I'd start by multiplying the numerator and denominator by the conjugate of the denominator to make the denominator real.
However, if you know contour integration, this problem becomes almost trivial by decomposing the integrand using Partial Fraction Decomposition: $$ \frac1{z^2+4}=\frac1{4i}\left(\color{#C00000}{\frac1{z-2i}}-\frac1{z+2i}\right) $$ giving an integral of $\frac\pi2$. This is because the only singularity of the integrand inside the contour of integration is $z=2i$, and the residue of $\frac1{z-2i}$ is $1$. Thus, the integral is $\frac{2\pi i}{4i}=\frac\pi2$.
To handle the second integral we can decompose $$ \frac1{(z^2+4)^2} =\frac1{32i}\left(-\frac{2i}{(z-2i)^2}\color{#C00000}{+\frac1{z-2i}}-\frac{2i}{(z+2i)^2}-\frac1{z+2i}\right) $$ The residue of the only singularity inside the contour is $\frac1{32i}$. Thus, the integral is $\frac{2\pi i}{32i}=\frac\pi{16}$.