Contour integral of inverse square root. I want to calculate the below complex integral on the upper-semi-circle which its radius goes to infinity:
$$ \oint \frac{dz}{\sqrt{1+z^2}}$$
I tried with the substitution $z = R e^{i \theta}$ where $0<\theta<\pi$, and then took the limit where $R$ goes to infinity, but I counldn't find sensible result.  Is it due to the fact that my substitution crosses the branch cut? (Either the cut taken from $i$ to infinity or to connect $-i$ and $i$.) If this is the case, how can one evaluate this integral, by the way if it converges.
 A: Idea:
Note that for large $R$ we have that $\sqrt{1+z^2} \approx z$. This result is analytic without any branch cut. So it is useful for integration. 
Formal:
We have to branch points of $\sqrt{1+z^2}$ at $z=\pm i$. We may choose the branch cut between between these branch points. With this choice, we have that (for $|z| > 1$)
$$ \sqrt{ 1+z^2} = z \sqrt{1+1/z^2}$$
where on the right hand side the branch cut does not play a role [as $\operatorname{Re}(1+1/z^2)>0$].
With that we have for the upper semi-circle ($z= R e^{i\theta}$)
$$\int  \frac{dz}{\sqrt{1+z^2}} = \int  \frac{dz}{z \sqrt{1+1/z^2}}  = i \int_{0}^{\pi} d\theta + O(1/R) \to \pi i \quad (R\to \infty).$$
To this, we add the contribution of the integral along the real line. For this we obtain 
$$\int_{-\infty}^{\infty}\frac{dx}{\pm\sqrt{1+x^2}}$$ 
where the sign $+$ has to be chosen for $x>0$ and $-$ for $x<0$ (given that the branch cut is between $+i$ and $-i$). Due to the fact that we integrate an odd function, this part of the contour vanishes and we have that
$$\oint \frac{dz}{\sqrt{1+z^2}} = i \pi\;.$$
