We are looking for expressions for the $\log(\frac{a^2+z^2}{z^2})$ inside the integral along the contour segments at the sides of the vertical branch cut that goes from $-ia$ to $ia$. Say the left segment is $C_1$ and the right segment is $C_2$ (both at the upper half plane). Then we have the following cases.
Segment $C_1$:
We select an arbitrary point $z=|z|e^{i\theta}$ of the segment $C_1$. The vectors that go from $ia$ and $-ia$ to $z$ form the corresponding complex numbers $(z-ia)=|z-ia|e^{i\theta_1}$ and $(z+ia)=|z+ia|e^{i\theta_2}$. Then we can write:
$$\frac{z^2+a^2}{z^2}=\frac{|z-ia|e^{i\theta_1}|z+ia|e^{i\theta_2}}{|z|^2e^{i2\theta}}=\frac{|z^2+a^2|}{|z|^2}e^{i(\theta_1+\theta_2-2\theta)}=\Big|\frac{z^2+a^2}{z^2}\Big|e^{i(\theta_1+\theta_2-2\theta)}$$

Now, as our segment $C_1$ approaches arbitrarily closer to the vertical branch, we have that:
$$\theta \to \frac{\pi}{2}, \theta_1 \to \frac{3\pi}{2}, \theta_2 \to \frac{\pi}{2}$$
Then:
$$\frac{z^2+a^2}{z^2}=\Big|\frac{z^2+a^2}{z^2}\Big|e^{i(\frac{3\pi}{2}+\frac{\pi}{2}-2\frac{\pi}{2})}=\Big|\frac{z^2+a^2}{z^2}\Big|e^{i\pi}$$
Therefore:
$$\log\Big(\frac{z^2+a^2}{z^2}\Big)=\log\Big|\frac{z^2+a^2}{z^2}\Big|+i\pi$$
Segment $C_2$:
The reasoning in this case is analogous to the previous one. With the difference now we have that, when the segment $C_2$ approaches the branch, the angles tend to:
$$\theta \to \frac{\pi}{2}, \theta_1 \to \frac{-\pi}{2}, \theta_2 \to \frac{\pi}{2}$$

Then:
$$\frac{z^2+a^2}{z^2}=\Big|\frac{z^2+a^2}{z^2}\Big|e^{i(-\frac{\pi}{2}+\frac{\pi}{2}-2\frac{\pi}{2})}=\Big|\frac{z^2+a^2}{z^2}\Big|e^{-i\pi}$$
Therefore:
$$\log\Big(\frac{z^2+a^2}{z^2}\Big)=\log\Big|\frac{z^2+a^2}{z^2}\Big|-i\pi$$
And that way we have determined the angles corresponding to a composite function at the path segments running along the branch cut.