Consider the following problem (Exercise 2.71 in *Curves and Surfaces*, 2nd Edition, by Montiel and Ros):

Let $S$ be a surface and let $R$ be a straight line of $\mathbb{R}^3$. Prove that if $S$ is compact, then there is a point of $S$ whose normal line intersects $R$ perpendicularly.

My attempt of solution:

Let $R = \{ta + p_0 \in \mathbb{R}^3 \ ; \ t \in \mathbb{R} \}$, with $|a| = 1$, and consider $$ h(p) = |p-p_0|^2 - \langle p - p_0, a \rangle^2 $$ be the square of the distance between $p \in S$ and $R$. Since $h$ is continous and $S$ is compact, we know that $h$ attains an extremum and hence has a critical point. Let $p$ be the critical point. Then, for every $v \in T_pS$ we know that $$ (dh)_p(v) = 0 \implies \langle v, p-p_0 \rangle = \langle p - p_0, a \rangle \langle v, a \rangle. $$ Note that from this it follows that $a \in T_pS$. Hence $R$ is parallel to $T_pS$.

At this point I am stuck. Any hints will be the most appreciated. Thanks in advance.