Calculating integral with branch cut. I'm learning how to calculate integrals with branch points using branch cut. For example:
$$I=a\int_{\xi_{1}}^{\xi_{2}}\frac{d\xi}{(1+\xi^{2})\sqrt{\frac{2}{m}\left(E-U_{0}\xi^{2}\right)}}$$
where $\xi_{1}$, $\xi_{2}$ is branch points.
I've choosed contour like this:

So, by using residue theorem (and changing sings that metion here)
$$I=2\pi i[Res(\infty)-Res(i)-Res(-i)]$$
Obviously
$$Res(\infty)=0$$
$$Res(i)=\frac{1}{2i}\frac{a}{\sqrt{\frac{2}{m}\left(E+U_{0}\right)}}$$
$$Res(-i)=-\frac{1}{2i}\frac{a}{\sqrt{\frac{2}{m}\left(E+U_{0}\right)}}$$
So I have a mistake somewhere because integral vanishes. The answer would be correct if there would be the minus sign before Res(i). I am totally confused by it. I will be grateful if you could tell me where my mistake, or give any links. 
 A: See this for a similar analysis.
I would rescale the integral as follows:
$$\frac{a}{\sqrt{U_0}} \int_{-1}^1 \frac{dz}{[1+(E/U_0) z^2] \sqrt{1-z^2}}$$
To consider this integral, consider the function
$$f(z) = (1-z)^{-1/2} (1+z)^{-1/2} = e^{-(1/2) \log{(1-z)}} e^{-(1/2) \log{(1+z)}}$$
The contour we choose is a dumbbell contour that encircles the chosen branch cut between $[-1,1]$.  Individually, however, the branch cuts were $[1,\infty)$ and $(-\infty,-1]$, respectively.  Thus, $\arg{(1-z)} \in [0,2 \pi)$ and $\arg{(1+z)} \in [-\pi,\pi)$.  Thus, while we may set $\arg{(1+z)} = 0$ on the contour segments above and below the real line, we must have that $\arg{(1-z)} = 0$ below the real line, and $\arg{(1-z)} = 2 \pi$ above the real line.
Above the real axis, then
$$f(z) = (1-z^2)^{-1/2}$$
Below, however,
$$f(z) = (1-z^2)^{-1/2} e^{-i (1/2) 2 \pi} = - (1-z^2)^{-1/2}$$
so that
$$\oint_C  \frac{dz}{[1+(E/U_0) z^2] \sqrt{1-z^2}} = 2 \int_{-1}^1 \frac{dz}{[1+(E/U_0) z^2] \sqrt{1-z^2}}$$
You are correct that the residue at infinity is zero.  The residues at $z=\pm i \sqrt{(U_0/E)}$ do not cancel because the factor $(1-z^2)^{-1/2}$ takes on different signs above and below the branch cut.  Therefore, the residues add.
Putting this all together, I get the value of your original integral as
$$\sqrt{\frac{m}{2}} \frac{a \pi}{\sqrt{E+U_0}}$$
A: The mistake is hidden in the square root which should be defined and treated carefully. 
For example, take a point $A$ on the real axis between $\xi_1$ and $\xi_2$ very close to $\xi_1$, define the square root to be positive at $A$. Consider $A$ as being on the upper side of the branch cut. Now, when we make a counterclockwise tour around $\xi_1$, the argument of the expression under square root will change by $2\pi$, hence the whole square root will be multiplied by $e^{2\pi i/2}=-1$. Therefore, the residues at $\pm i$ will contribute with opposite signs. 
Or, more correctly, the residues appear with the same sign but the function itself changes the sign: it is real and positive for purely imaginary $\xi$ between $0$ and $i$ and real negative for  purely imaginary $\xi$ between $-i$ and $0$.
Hope this is understandable.
