Example 5 (IMO - 39 Problem) Determine all pairs of positive integers $(a, b)$ such that $a b^{2}+b+7$ divides $a^{2} b+a+b$.

Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
Let the pair of positive integers $(a, b)$ satisfy $a b^{2}+b+7 \mid a^{2} b+a+b$, then we have $a b^{2}+b+7 \mid a\left(a b^{2}+b+7\right)-b\left(a^{2} b+a+b\right)$, which means $a b^{2}+b+7 \mid 7 a-b^{2}$.
(i) When $7 a-b^{2}=0$, i.e., $7 \mid b$,
let $b=7 k$, then $7 a=7^{2} k^{2}, a=7 k^{2}$, at this point we have $a^{2} b+a+b=k\left(a b^{2}+b+7\right)$.
Hence $(a, b)=\left(7 k^{2}, 7 k\right)$ is a solution to the problem.
(ii) When $7 a-b^{2}>0$, we have $7 a-b^{2} \geqslant a b^{2}+b+7$,
$7 a>a b^{2}, b^{2}<7$, so $b=1$ or 2.
If $b=1$, then $a+8 \mid a^{2}+a+1$.
Let $a+8=u$, then $a^{2}+a+1=(u-8)^{2}+(u-8)+1=u^{2}-15 u+59$.
By $u \mid u^{2}-15 u+59$, we get $u \mid 59$,
thus $u=19$ or 57, which gives $a=11$ or 49.
At this point, we get two more solutions $(a, b)=(11,1)$ or $(49,1)$.
If $b=2$, then $4 a+9 \mid 7 a-4$.
Since $4 a+9 \leqslant 7 a-4<2(4 a+9)$, the inequality does not hold for positive integers $a$.
In summary, the solutions are
$$
(a, b)=\left(7 k^{2}, 7 k\right),(11,1),(49,1), k \in \mathbf{N}^{+} .
$$