The lines that contains $P$ have equations: $y-1=m(x-7)$ and we want the lines that have only a common point with the circle $x^2+y^2=25$.
The common points are the solutions of the system
$$
\begin{cases}
x^2+y^2=25\\
y-1=m(x-7)
\end{cases}
$$
Substituting $y$ ( or $x$) from the second to the first equation you find a second degree equation in $x$ (or $y$) and this equation has only one solution (only one common point) iff its discriminant is null.
Note that the discriminant $\Delta(m)$ is a second degree polynomial in $m$ so The equation $\Delta(m)=0$ can have $2$ distinct solutions ( if the point $P$ is external to the circle and we have two tangent lines), one solution ( if the circle contains $P$ so that we have only one tangent line) or no real solutions if the point $P$ is inside the circle.
Anyway, solving $\Delta(m)=0$ you find the slope of the tangents lines, if they exist.