Please bear in mind that I am trying to teach myself complex integration having never taken a course in complex analysis, so assume I know very little.
$\int \frac{2+\sin(z)}{z} dz$ traversing the unit circle once counterclockwise.
I looked up cauchy's integral formula, but I don't know how to apply it. What do I do?
I'm getting $4 \pi i$ by saying $\int \frac{2+\sin(z)}{z} dz = 2+ \sin(0) $but i'm pretty sure that's wrong.
Let the contour $\gamma$ be $$\gamma(t) = e^{it},\; 0 \leq t \leq 2\pi $$ We want to calculate the result of the contour integral
$$\oint_{\gamma}\frac{2 + \sin(z)}{z} \; \text{d}z$$
With the theory of complex residues, a contour integral $\oint_{\gamma} f(z) \; \text{d}z$ is equal to $2\pi i$ times the sum of all complex residues of the singularities $z_i$ of the function $f(z)$ which are inside the closed curve $\gamma$. That is
$$\oint_{\gamma} f(z) \; \text{d}z = 2\pi i \sum_{z_i} \text{Res}(f, z=z_i)$$ Looking at your integrand $$f(z) = \frac{2+\sin z}{z}$$ We see that there is a simple pole (of degree $1$) at $z = 0$. Since $\gamma$ is the closed curve describing the unit circle, the point $z = 0$ lies within that unit circle. So we have
$$\oint_{\gamma}\frac{2 + \sin(z)}{z} \; \text{d}z = 2\pi i\cdot \text{Res}(f, z_0=0)$$
For this, we must now calculate the complex residue of the singularity of $f$ at $z_0=0$. Using the formula on wikipedia, we have for a simple pole at $z_0$:
$$\text{Res}(f, z_0 =0) = \lim_{z \to z_0} (z-z_0)f(z)$$
Substituting that in, we get
$$\lim_{z \to z_0} (z-z_0)f(z) = \lim_{z \to 0} \; 2+\sin z = 2 + \sin(0) = 2 $$
And as such the residue of the singularity of the function $f(z)$ at $z=0$ is equal to $2$. We get the result of the contour integral as
$$\oint_{\gamma}\frac{2 + \sin(z)}{z} \; \text{d}z = 2\pi i\cdot 2 = 4\pi i$$