calculus and analysis – Non-convergent integral converging after variable transformation

When I try to integrate the following function with Integrate(…)

$$int_0^1 dx frac{1}{1-x}left(frac{1-x}{x} right)^i.$$

mathematica says that it is not convergent. But after a change of variables $z=frac{1-x}{x}$ with $dz=frac{1}{(1+z)^2}$ the integral becomes

$$int_0^{infty} dx frac{1}{z(1+z)}z^i$$

which mathematica now evaluates to $-i pi sinh^{-1}(pi)$.

How is this possible?