Complex substitution allowed but changes result It is well known that
$$ I := \int_L \frac{1}{z} ~\text{d}z = 2 \pi i $$
where $L$ is the complex unit circle, parametrized by $\gamma(t) = e^{it}, 0 \leq t \leq 2 \pi$. However, using complex substitution, I obtain the following: by definition op complex line integrals, we have
$$ I = \int_{t = 0}^{t = 2\pi} \frac{1}{e^{it}} \cdot i e^{it} ~\text{d}t $$
Since $e^{it}$ is complex differentiable everywhere, and since $1/z$ is complex differentiable on the entire complex unit circle $L$, we can use complex substitution: $u = e^{it}$ and $\text{d}u = i e^{it} ~\text{d}t$, hence
$$ I = \int_{u = 1}^{u = 1} \frac{1}{u} ~\text{d}u = 0 $$
since the integral is from 1 to 1.
Obviously, something went wrong. My teacher said that it was because both $1/z$ was not defined on the whole interior of $L$ (since $z = 0$ causes trouble) and because it's "anti-derivative" Log$(z)$ is not continuous on $L$ (it's not continuous on the negative real axis). If either $1/z$ was defined on the whole interior of $L$ or Log$(z)$ was continuous on $L$ itself, then the above would be true. For example,
$$ \int_L z^2 ~\text{d}z = 0 $$
However, if you are just given
$$ \int_{t = 0}^{t = 2\pi} \frac{1}{e^{it}} \cdot i e^{it} ~\text{d}t $$
Then you have no idea that this integral comes from some line integral over some line $L$. So my question is, what conditions have to be met in order to apply the equality
$$ \int_{t = a}^{t = b} f(\gamma(t)) \cdot \gamma'(t) ~\text{d}t = \int_{t = \gamma(a)}^{t = \gamma(b)} f(t) ~\text{d}t $$
for $\gamma : [a, b] \to M$, $f : D \to \mathbb{C}$ such that $M \subset D$, and why can't I write
$$ I = \int_{t = 0}^{t = 2\pi} \frac{1}{e^{it}} \cdot i e^{it} ~\text{d}t = \int_{u = 1}^{u = 1} \frac{1}{u} ~\text{d}u $$
My book on Complex Analysis simply says that $\gamma$ needs to be complex differentiable on $[a, b]$ (and $e^{it}$ is complex differentiable on $[0, 2 \pi]$) and that $f$ needs to be continuous on $M$ (and $1/z$ is continuous on $L$, the image of $e^{it}$). Either my book is wrong, or (most likely) I'm missing something.
 A: 
See THIS ANSWER for a detailed development of the evaluation of $\int_\gamma \frac1z\,dz$, where $\gamma$ is any rectifiable curve in $\mathbb{C} \setminus\{0\}$.

To make this clear, the substitution $u=e^{it}$ is appropriately used if we cut the plane along the positive real axis emanating from the branch point at $z=0$.  Then, we can write
$$\begin{align}
\oint_{|z|=1}\frac{1}{z}\,dz&=\int_0^{2\pi}\frac{ie^{it}}{e^{it}}\,dt\\\\
&=\lim_{\epsilon \to 0^+}\int_0^{2\pi -\epsilon}\frac{ie^{it}}{e^{it}}\,dt\\\\
&=\lim_{\epsilon \to 0^+}\int_1^{e^{i(2\pi -\epsilon)}}\frac{1}{u}\,du\\\\
&=\lim_{\epsilon \to 0^+}\left(\left.(\log(u)\right|_{1}^{e^{i(2\pi - \epsilon)}}\right)\\\\
&=\lim_{\epsilon \to 0^+}\left(\log(e^{i(2\pi -\epsilon)})-\log(1)\right)\\\\
&=\lim_{\epsilon \to 0^+}\left(i(2\pi -\epsilon)\right)\\\\
&=i2\pi
\end{align}$$
as expected!
In fact, using the outlined approach, we see that in general
$$\int_0^{\phi}\frac{ie^{it}}{e^{it}}\,dt=i\phi $$
Note that if we encircled the origin a second time, then $\phi=4\pi$ and the value of the integral would be $i4\pi$.  
