Complex integration: choosing a contour without divergences How should I pick the contour to compute the integral
$$\int_{-a}^a\frac{1-z}{\sqrt{(z-a)(z+a)}}\mathrm d z\,, $$
where $a$ is a real number?
My problem is that when I choose a keyhole contour around the cut $(-a,a)$, the big circle with radius $R$ going to infinity diverges. The integrand goes as
$$\frac{1-z}{\sqrt{(z-a)(z+a)}} \sim i-\frac{i}{z}+i\frac{ a^2}{2 z^2}+O\left(\frac{1}{z^3}\right)\,,$$
for $|z|\rightarrow \infty$ and thus
$$ \lim_{R\rightarrow \infty}\int_R\frac{1-z}{\sqrt{(z-a)(z+a)}}\mathrm d z < \lim_{R\rightarrow\infty}( i\times (2\pi R))=\infty\,.$$
But I know that the answer is finite as 
$$\int_{-a}^a\frac{1-z}{\sqrt{(z-a)(z+a)}}\mathrm d z =\pi\,. $$
Where am I doing something wrong?
 A: I think that taking into account the helpful comment asking me to consider the residue at infinity, the right contour is the following

Call $C_{\epsilon,\pm}$ the small circles with radius $\epsilon$ around $-a$ and $a$ respectively, $J_{\pm}$ the part of the path just above and below the cut connecting $a$ and $-a$ and the big circle going to infinity has a radius $R$.
As the only pole when circling the branch cut joining $a$ to $-a$ 
$$2\pi i\text{ Res}(f(z),z=\infty)=\left(\int_{C_{\epsilon,+}}+\int_{C_{\epsilon,-}}+\int_{J_+}+\int_{J_-}\right)f(z)\mathrm d z\,, $$
where 
$$f(z)=\frac{(1-z)}{\sqrt{(z-a)(z+a)}}\,. $$
Since
$$\lim_{\epsilon\rightarrow 0}\int_{C_{\epsilon,\pm}}\frac{(1-z)}{\sqrt{(z-a)(z+a)}} \mathrm d z \rightarrow 0$$
the equality reduces to 
$$\text{Res}(f(z),z=\infty)=\left(\int_{J_+}+\int_{J_-}\right)f(z)\mathrm d z\,, $$
The two integrals along the straight lines $J_{\pm}$ add up as one can remark that 
$$\sqrt{(z-a)(z+a)}=\begin{cases} \sqrt{x^2-a^2} && a<x<\infty\\ -\sqrt{x^2-a^2}  && -\infty<x<-a\\ i\sqrt{a^2-x^2}  && -a<x<a  &y\rightarrow 0^+\\ -i\sqrt{a^2-x^2}  && -a<x<a  &y\rightarrow 0^-\end{cases} $$
and so that 
$$\int_{J_+} \mathrm d z \, f(z +i\epsilon)=\int_{J_-} \mathrm d z \, f(z-i\epsilon)= -iI $$
with $\epsilon$ an infinitessimally positive small real number and $I$ the integral we are looking for.
Now Res$(f(z),z=\infty)=-1$ such that
$$I= \pi.  $$
