By Hilbert projection theorem, if $x\in\mathbb{R}^n$ and $D$ is a closed subspace of $\mathbb{R}^n$ then the optimization problem $$\underset{y}{\min} \|x-y\| \ s.t. \ y \in D \quad\quad (P1)$$ has an unique solution, namely, the $\bar{x} \in \mathbb{R}^n$ such that $x-\bar{x}$ is orthogonal to $D$.
Consider now that $D$ is a compact differentiable manifold. Since $f(y):=\|x-y\|$ is a continuous function on the compact $D$, the optimization problem (P1) has a global minimum $\bar{x}$.
It must be the case that $x-\bar{x}$ is normal to the tangent space of $D$ at $\bar{x}$?