Prove that $\int_1^{\infty}\frac{dx}{x\sqrt{x^2-1}}=\frac{\pi}{2}$ using complex analysis

Here is the contour of integration and the signs of $\sqrt{z^2-1}$ near the real axis. For large $|z|$, in the upper half-plane, $\sqrt{z^2-1}\approx+z$, whereas in the lower half-plane, $\sqrt{z^2-1}\approx-z$. Note that along the imaginary axis, $\sqrt{z^2-1}$ is positive imaginary, so at $z=0$, we have $\sqrt{z^2-1}=+i$.

This means that $\operatorname*{Res}\limits_{z=0}\left(\frac1{z\sqrt{z^2-1}}\right)=-i$.

enter image description here

The integral along the blue contours vanishes. On the large blue circles, the size of the integrand is $\sim\frac1{|z|^2}$ and on the small blue circles, the size of the integrand is $\sim\frac1{\sqrt{2|z-1|}}$ and $\sim\frac1{\sqrt{2|z+1|}}$

The integral along each of the red and green contours is the integral we want due to the signs of $z$, $\sqrt{z^2-1}$, and the direction of the contour.

Therefore, $$ \begin{align} 4\int_1^\infty\frac{\mathrm{d}z}{z\sqrt{z^2-1}} &=2\pi i\operatorname*{Res}_{z=0}\left(\frac1{z\sqrt{z^2-1}}\right)\\ &=2\pi \end{align} $$ Thus, $$ \int_1^\infty\frac{\mathrm{d}z}{z\sqrt{z^2-1}}=\frac\pi2 $$