Let $f$ and $g$ be continuous functions on $[0,\infty)$. Assume that
$$f(x) - f(\infty) = \sum_{k\ge0}\frac {u(k)(-x)^k}{k!} \;\text{ and }\; g(x) - g(\infty) = \sum_{k\ge0}\frac {v(k)(-x)^k}{k!},$$
where $$f(\infty) = \lim_{x\to\infty}f(x) \;\text{ and }\; g(\infty) = \lim_{x\to\infty}g(x)$$ exist and are finite.

The following statement is called Master Theorem (I don't remember exactly the source exactly but it was given by Hardy.):
\begin{align*}
I_n &= \int_0^{\infty}x^{n-1}(f(ax) - f(\infty)) - (g(bx) - g(\infty))dx \\ &=\Gamma(n)[a^{-n}(-n) - b^{-n}v(-n)]\\
&= \Gamma(n+1)\left(\frac {a^{-n}u(-n) - b^{-n}v(-n)}{n}\right),
\end{align*}
for $0<n<1$. We take the limit as $n\to 0^+$, hence
\begin{align*}
\lim_{n\to0^+}\left(\frac{b^nv(n) - a^u(n)}{n}\right)
&= \lim_{n\to0^+}(n^nv(n)\ln b + b^nv'(n) - a^nu(n)\ln a - a^nu'(n)) \\
& = (f(0) - f(\infty))\left(\ln \frac ba + \frac d{ds}\left( \ln \left(\frac {v(s)}{u(s)}\right)_{s = 0}\right)\right).
\end{align*}
Here, $u(0) = v(0) = f(0) - f(\infty)$.
Thus,
$$I_0 = (f(0) - f(\infty))\left(\ln\left(\frac ba\right) + \frac d{ds}\left(\ln\left(\frac {v(s)}{u(s)}\right)\right)_{s = 0}\right).$$

In particular,
$$\begin{align*}
\int_0^{\infty}\frac {(1+ax)^{-p} - (1+bx)^{-q}}{x}dx
& = \ln\frac ba + \frac {d}{ds} \ln\left(\frac {\Gamma(q+s)\Gamma(p)}{\Gamma(p+s)\Gamma (q)}\right)_{s =0}\\
& = \ln \frac ba + \psi(q) - \psi(p),
\end{align*}$$
with $a, b, p, q > 0$.