Evaluating an integral over a closed curve I want to evaluate $\displaystyle \int_\gamma \frac{dz}{z-2} $ where $\gamma $ is the circle $|z|=3$. 
Try:
We know $\gamma(t) = 3e^{it}$ where $t \in [0,2 \pi] $. So, 
$$\int \frac{ dz}{z-2} = \int_0^{2\pi} \frac{ 3 i e^{it} \, dt}{3e^{it}{-2}}$$
When I solve this integral I get $0$. But, according to my notes, I should get $2 \pi i $. What am I doing wrong ?
 A: Hard to guess how you "solved" the integral, but due to the residue theorem,
$$ \int_{\gamma}\frac{dz}{z-2} = 2\pi i\cdot \text{Res}\left(\frac{1}{z-2},z=2\right) = 2\pi i.$$
You may check that the integral along $\gamma$ is the same along $|z-2|=1$, counter-clockwise oriented.
A: As pointed out by @JackD'Aurizio, the integral can be evaluated quickly using the residue theorem.  
If one is interested, however, in evaluating the integral more directly, then we can proceed as in the OP.  We describe the contour $\gamma$ parametrically as $z=3e^{it}$.  Then, the integral of interest is
$$\begin{align}
\int_0^{2\pi} \frac{ 3 i e^{it} }{3e^{it}-2}\,dt&=\int_0^{2\pi} \frac{ 3 i e^{it}\left(3e^{-it}-2\right) }{13-12\cos t}\,dt \tag 1\\\\
&=\int_0^{2\pi} \frac{ 3 i \left(3-2\cos t\right) }{13-12\cos t}\,dt \tag 2\\\\
&=\frac i2\int_0^{2\pi} \frac{ 18-12\cos t }{13-12\cos t}\,dt \tag 3\\\\
&=i\pi+\frac i2\int_0^{2\pi} \frac{ 5 }{13-12\cos t}\,dt \tag 4\\\\
&=i\pi+\frac i2\,5\frac{ 2\pi }{5} \tag 5\\\\
&=i2\pi
\end{align}$$
as expected!

NOTE 1:
In arriving at the right-hand side of $(1)$, we used $\frac{ 3 i e^{it} }{3e^{it}-2}=\frac{ 3 i e^{it} }{3e^{it}-2}\frac{3e^{-it}-2}{3e^{-it}-2}=\frac{ 3 i e^{it}\left(3e^{-it}-2\right) }{13-12\cos t}$.
In going from $(1)$ to $(2)$, we exploited the facts that (i) the sine function is odd, periodic function with period $2\pi$, and (ii) the integral of an odd function about symmetric limits is zero.
In going from $(2)$ to $(3)$, we simply multiplied and divided by $6$ and brought the factor $i/2$ outside the integral.
In going from $(3)$ to $(4)$, we split the numerator into $5+(13-12\cos t$, and simplified by carrying out the integral of $1$.
In going from $(4)$ to $(5)$, used the Weierstrass substitution $\tan(t/2)=x$ to carry our the integral.

NOTE 2:
It might be tempting to write naively 
$$\int_0^{2\pi} \frac{ 3 i e^{it} }{3e^{it}-2}\,dt=\left.\log (3e^{it}-2)\right|_{t=0}^{t=2\pi}=\log (3-2)-\log (3-2)=0$$
This reason that this is not correct is that the complex logarithm is not a single-valued function in the complex plane. Instead, we have $\log (3e^{it}-2)=\log |3e^{it}-2|+i\arg(3e^{it}-2)$.  
If we restrict the argument of $3e^{it}-2$ such that $0\le \arg(3e^{it}-2) <2\pi$, then for $t=0$, $\arg(3e^{it}-2)=0$, while at $t=2\pi^{-}$, $\arg(3e^{it}-2)=2\pi$ and the integral of interest is $i2\pi$.
A: Using Cauchy's Integral Theorem, the integral over the following contour is $0$:

This contour is the difference of the contour for $\left|\,z\,\right|=3$ and the contour $\left|\,z-2\,\right|=1$. Therefore,
$$
\begin{align}
\int_{|z|=3}\frac{\mathrm{d}z}{z-2}
&=\int_{|z-2|=1}\frac{\mathrm{d}z}{z-2}\\
&=\int_{|z|=1}\frac{\mathrm{d}z}{z}\\
&=\int_0^{2\pi}\frac{i\,e^{it}\,\mathrm{d}t}{e^{it}}\\[6pt]
&=2\pi i
\end{align}
$$
