Example 5 Find a point $P(x, y)$ on the line $l: x+y-5=0$, such that the angle $\angle A P B$ subtended by $P(x, y)$ to points $A(1,0)$ and $B(3,0)$ is maximized.
Solution 1: As shown in Figure $17-1, |AB|=2, P(x, y)$ is a point on $l$. Draw $AE$ and $BF$ perpendicular to $AB$, intersecting $l$ at $E$ and $F$. Clearly, $\angle AEB = 0$, and if $a \neq 1$, then $a > 0$, thus $a_{\max} = \frac{1}{7}$. Therefore, $\alpha_{\max} = \operatorname{arctg} \frac{1}{7}$.
In summary, the maximum value of $\angle APB$ is $\frac{\pi}{4}$, and the coordinates of point $P$ are $(3,2)$.
Solution 2: Consider geometric intuition.
If the angle $\angle APB$ formed by a point on line $l$ and two points $A, B$ outside line $l$ is maximized, then the circle $APB$ is tangent to line $l$. Otherwise, $l$ and circle $P$ would have another common point $Q$, and when $M \in PQ$, $\angle AMB > \angle APB$.

It is easy to know that the intersection point of $l$ and $AB$ is $C(5,0)$. Then, by the power of a point theorem, $|CP|^2 = |AC| \cdot |BC| = 8$, i.e., $|CP| = 2\sqrt{2}$. Thus,
the equation of line $l$ is $\left\{\begin{array}{l}x=3+t \cos \frac{3 \pi}{4} \\ y=t \sin \frac{3 \pi}{4}\end{array}\right.$ (where $t$ is a parameter).

Taking $t = \pm 2\sqrt{2}$, we get $P_1(3,2), P_2(7,-2)$.
Since $\angle AP_1B = \frac{T_1}{4}, \angle AP_2B < \frac{T_1}{4}$, $\angle AP_1B$ is the maximum, and $P_1(3,2)$ is the required point $P$.