$f(z)=\sqrt{1-z^2}$ pole at infinity Consider integrating $f(z)=\sqrt{1-z^2}$ with a branch cut of $[-1,1]$ around the following contour.
$\gamma_1:[-1,1]\to\mathbb{C}, t\mapsto t+\epsilon i$
$\gamma_2:[-\pi/2,\pi/2]\to\mathbb{C}, t \mapsto 1+\epsilon e^{-it}$
$\gamma_3:[-1,1]\to\mathbb{C}, t\mapsto -t-\epsilon i$
$\gamma_4:[-3\pi/2,-\pi/2]\to\mathbb{C}, t \mapsto -1+\epsilon e^{-it}$
As $\epsilon$ tends to $0$ we have that $\int_{\gamma_2}f(z)dz$ and $\int_{\gamma_4}f(z)dz$ tend to $0$. 
Now, $\int_{\gamma_1}f(z)dz$ tends to $\int_{-1}^{1}\sqrt{1-x^2}dx:=I$ and also $\int_{\gamma_3}f(z)dz$ also tends to $I$ (one minus sign from being on the other side of the branch cut, another one from reversing the lower/upper limits).
Now $I=\pi/2$
So the integral around the closed contour $\lim_{\epsilon\to 0}\int_{\gamma_1+\gamma_2+\gamma_3+\gamma_4} f(z) dz=\pi$
Note that $f$ is analytic in $\mathbb{C}\setminus[-1,1]$ with our choice of branch cut and so we can consider the contour integral around $\gamma=\gamma_1+\gamma_2+\gamma_3+\gamma_4$ as a closed contour around infinity.
i.e. $\int_{\gamma}f(z)dz=-2\pi i Res[f,z=\infty]$
($-2\pi i$ instead of $2\pi i $ because we are going clockwise around infinity.)
Now, $Res[f,z=\infty]=Res[\sqrt{1-1/z^2},z=0]=\lim_{z\to 0}z\sqrt{1-1/z^2}=\lim_{z\to 0}\sqrt{z^2-1}=i$
So $\int_{\gamma}f(z)dz=-2\pi i (i)=2\pi$
And the two results do not agree. I am not confident my arguments about the pole at infinity. What exactly did I do wrong there?

See this answer. You have implicitly used the condition that $f(x + i0) > 0$ for $-1 < x <1$ (otherwise you would get $I = -\pi$). With this condition, $f$ can be written as
$$f(z) = -i z \sqrt {1 - \frac 1 {z^2}},$$
where $\sqrt z$ is the principal value of the square root.
$\gamma$ goes around the origin clockwise, therefore $I = +2 \pi i \operatorname{Res}_{z = \infty} f(z)$. By the binomial theorem, the Laurent expansion of $\sqrt {1 - 1/z^2}$ around infinity is $1 - 1/(2 z^2) + O(1/z^3)$, which gives $\operatorname{Res}_{z = \infty} f(z) = 1/(2 i)$.
