What is the solution to the following integral (if there is any)? $$I = \operatorname{Re}\int_0^{\infty}dx \frac{1-ix}{\sqrt{a^2-(1-ix)^2}},$$ where it is known that $a>1$.
My approach: I'm not getting any progress with taking the integral before the real part, but I'm pretty sure I'm allowed to exchange integration and real part as I want. If so, then by introducing $b(x) = a^2+x^2-1$, we can rewrite the integral as $$ I = \int_0^{\infty}dx \frac{\cos\left(\frac{1}{2}\arg\left(b+2ix\right)\right) -x\sin\left(\frac{1}{2}\arg\left(b+2ix\right)\right)}{\sqrt[4]{b^2+4x^2}}.$$ By using that $\sin(\frac{1}{2}\arcsin(x)) = \frac{1}{2}(\sqrt{x+1}-\sqrt{1-x})$, and $\cos(\frac{1}{2}\arccos(x)) = \frac{1}{\sqrt{2}}\sqrt{x+1}$, I believe that the integral can be rewritten $$I = \int_0^{\infty}dx \frac{ \frac{1}{\sqrt{2}}\sqrt{\frac{b}{b^2+4x^2} + 1} - \frac{x}{2}\left[\sqrt{\frac{2x}{b^2+4x^2}+1} - \sqrt{1 - \frac{2x}{b^2+4x^2}}\right]}{\sqrt[4]{b^2+4x^2}} = \int_0^{\infty}dx \frac{ \frac{1}{\sqrt{2}}\sqrt{b^2+4x^2+1} -\frac{x}{2}\left[\sqrt{b^2+4x^2+2x} - \sqrt{b^2+4x^2-2x}\right] }{(b^2+4x^2)^{3/4}}.$$
Substituting $b$ back in again and collecting powers of x: $$ I = I_1 - I_2 + I_3,$$ where $$ I_1 = \frac{1}{\sqrt{2}}\int_0^{\infty}dx \frac{\sqrt{x^4+x^2(3+2a^2)+a^2(a^2-1)}}{\left[x^4+x^2(2+2a^2)+a^2(a^2-1)+1\right]^{3/4}},$$ $$ I_2 = \int_0^{\infty}dx\frac{\frac{x}{2}\sqrt{x^4+x^2(2+2a^2)+2x+a^2(a^2-1)+1} }{\left[x^4+x^2(2+2a^2)+a^2(a^2-1)+1\right]^{3/4}},$$ $$I_3 = \int_0^{\infty}dx\frac{\frac{x}{2}\sqrt{x^4+x^2(2+2a^2)-2x+a^2(a^2-1)+1} }{\left[x^4+x^2(2+2a^2)+a^2(a^2-1)+1\right]^{3/4}},$$ but here my progress ends since I can't seem to take these integrals.
Let $f(x) = (1 - i x)/\sqrt {a^2 - (1 - i x)^2}$ and assume that $\sqrt z$ is the principal value of the square root. Since $\lim_{x \to \infty} f(x) = -i$, $\int_0^\infty f(x) dx$ diverges. However, $$\int_0^A \operatorname {Re}(f(x)) dx = \operatorname {Re} \int_0^A f(x) dx$$ for $A \in \mathbb R$, because the integral on the rhs exists and $dx$ is real (that is, all $\Delta x_i$ in a Riemann sum are real). Then $$\operatorname {Re} \int_0^A f(x) dx = \operatorname {Re} \left( -i \sqrt {(x + i)^2 + a^2} \, \bigg\rvert_{x = 0}^A \right) = \operatorname {Im} \sqrt {(A + i)^2 + a^2}.$$ For $z$ in the upper half-plane, $$\operatorname {Im} \sqrt z = \frac {\operatorname {Im} z} {\sqrt {2 (|z| + \operatorname {Re} z)}}.$$ It follows that $$\lim_{A \to \infty} \operatorname {Im} \sqrt {(A + i)^2 + a^2} = 1.$$