I recently started studying complex function theory and I'm solving some exercises to understand the various theorems:
The firt exercise is:
Let $R := \{z = x + i y : |x| <1 \text{ and } 0 <y <2\}$. Determine (without calculation) the value of the integral $\int_{∂R} \frac{1}{(z − i)^3}dz$.
I have following solutions:
We have $\int_{∂R} \frac{1}{(z − i)^3}dz=-1/2(z-i)^{-2}|_{∂R}=0$
How did he understand so easily that the integral returned zero? What theorem did he use?
The second exercise where I have some questions is:
Determine the value of the integral $\int_{|z|=2}\frac{sin(z)}{z-\pi/4}dz$
The solutions are:
According to Cauchy's integral theorem
$\int_{|z|=2}\frac{sin(z)}{z-\pi/4}dz=2\pi i \dot \sin(\pi/4)=\pi i \sqrt{2}$
I don't understand how we manage to solve this integral using cauchy. Could someone explain it to me, perhaps by writing some middle steps?

For your first question, to solve the integral $\int_{\partial R}\frac{1}{(z-i)^3}\mathrm{d}z$, and note $z=i$ is inside domain $R$, one may use Goursat's formula: $$f^{(n)}(a)=\frac{n!}{2\pi i}\int_{C}\frac{f(z)}{(z-a)^{n+1}}\mathrm{d}z$$ where $C$ is enclosed curve and $a$ inside $C$. Then $a=i$ and $f(z)=1$, then it's easily to see the value of $\int_{\partial R}\frac{1}{(z-i)^3}\mathrm{d}z$ is $\frac{2\pi i}{2!}f^{(2)}(i)$, it is zero.
Similarly, for second question, the point $z=\frac{\pi}{4}$ is inside circle $|z|=2$, the Cauchy's integral formula gives the answer. $$\int_{|z|=2}\frac{\sin(z)}{z-\frac{\pi}{4}}\mathrm{d}z=2\pi i\cdot \sin(\frac{\pi}{4})$$