Example 5 Set $A=\{(x, y) \mid y=a x+1\}, B=\{(x, y) \mid y=| x |\}$, and $A \cap B$ is a singleton set, find the range of real number $a$.
Set $A$ is a line passing through the fixed point $(0,1)$, and set $B$ represents the angle bisectors of the first and second quadrants (including the origin). To make $A \cap B$ a singleton set, it is necessary and sufficient that the line intersects one of the two rays or passes through the origin. From the graph, we can see that $a \geqslant 1$ or $a \leqslant-1$.

Key Points for Solving This Problem: This example aims to find the number of elements in the intersection. "Combining numbers and shapes" is quick, convenient, and accurate. Of course, we can also solve the system of equations to find the range of $a$ for which $|x|=a x+1$ has a unique real root greater than $-\frac{1}{a}$, but the calculations are more cumbersome.