Does complex integration only depend on endpoints? I have been watching some videos on Complex Analysis and from my understanding, integrating an analytic function over a curve only depends on the endpoints of the curve.
If that is true, why does $\int dz/z$ evaluated along the unit circle equal $2\pi i$ instead of $0$?
 A: Yes, $\int_{\lvert z\rvert=1}\frac{\mathrm dz}z=2\pi i$. And therefore, no, it is not true that integrating an analytic function over a curve only depends on the endpoints of the curve. Because if you go from $1$ to $-1$ along a semicircle in the upper half plane, the value of the integral is $\pi i$, whereas if you go from $1$ to $-1$ along a semicircle in the lower half plane, the value of the integral is $-\pi i$.
A: The answer to this is actually, as you've seen, a little bit more subtle. What we can say is this:


*

*If $f$ is a function which is defined and holomorphic on a simply-connected set $D$, which is a subset of the plane, then the integral of $f$ between any two points $a$ and $b$ is independent of the path taken between them, so long as any path we choose remains wholly within $D$.


In your case, the function
$$f: \mathbb{C} \setminus \{0\} \rightarrow \mathbb{C},\ \ f(z) := \frac{1}{z}$$
with the start and end points equal to 1 and following the unit circle as the path runs afoul of the "defined on ... path remains within ... a simply-connected set $D$". If $D$ is any set which contains $0$ as a point, $f$ is not defined there; if it excludes $0$ but no other points, then it is not "simply connected": this condition basically means it "has no holes in it". In particular, if it includes any loop around $0$ but not $0$ itself, the set is not simply connected. This means no such set can include a path like the unit circle. It could include other paths that start or end at 1 like, say, a loop shaped like a kidney bean that leaves $0$ out, and in that case the integral is indeed path-independent (and equal to zero).
But once you are talking about a set that is not simply-connected, you lose the guarantee of path-independence. Note that not being simply-connected doesn't, itself, mean that the integral depends on path: we could consider a set containing the kidneybean curve just mentioned at cut out a circle from that set in the interior of that curve, thus no longer being simply connected, but the path-independence would remain.
A: If $f$ is the derivative of a diffentiable function $g$ and $\gamma$ is a path in the complex plane then $\int_{\gamma} f(z)dz=g(b)-g(a)$ where $a$ and $b$ are the end points of the path $\gamma$. So the integral depends only on the end points and it is $0$ when the end points  are the same. However this depends heavily on the fact that $f$ is derivative of a differentiable function $g$. The function $\frac 1 z$ does not have this property. 
A: If $D$ is a region in $ \mathbb C$ and $f:D \to \mathbb C$ is holomorphic and if $f$ has an anti-derivative on $D$, then integrating $f$ over a curve only depends on the endpoints of the curve.
If $D= \mathbb C \setminus \{0\}$ and $f(z)=1/z$ then $\int_{|z|=1} f(z) dz=2 \pi i \ne 0.$
Reason: $f$ has no anti-derivative on $D$.
