Example 5 Given the sets $A=\{x \mid(x-2)[x-(3 a+1)]<0\}, B=\left\{x \left\lvert\, \frac{x-2 a}{x-\left(a^{2}+1\right)}<0\right.\right\}$.
(1) When $a=2$, find $A \cap B$;
(2) Find the range of real numbers $a$ such that $B \subseteq A$.
Analysis We first simplify the sets, then process them.
Solution
(1) When $a=2$, $A=(2,7), B=(4,5)$, so $A \cap B=(4,5)$.
(2) Since $B=\left(2 a, a^{2}+1\right)$, when $a>\frac{1}{3}$, $A=(2,3 a+1)$, to make $B \subseteq A$, it is necessary that $\left\{\begin{array}{l}2 a \geqslant 2 \\ a^{2}+1 \leqslant 3 a+1\end{array}\right.$, at this time $1 \leqslant a \leqslant 3$.
In summary, the range of real numbers $a$ that makes $B \subseteq A$ is $[1,3] \cup\{-1\}$.
Comment This problem pays attention to case analysis.