As shown in the figure just below, there's a special relation between the angles $\theta$ and $\phi$ that gives the desired equation for lengths:

Point $P$ is on the ellipse. Its tangent makes angle $\phi$ with the major axis (taken to be the horizontal $x$-axis WOLG).
Make the respective line from the two foci $F_1$ and $F_2$ perpendicular to the tangent. The intersections with the tangent are $N_1$ and $N_2$, and the intersections with the horizontal line (that passes through $P$) are $Q_1$ and $Q_2$, respectively.
Since $P$ is on the ellipse, $~\overline{F_1 P} = r~$ makes $~\overline{F_2 P} = 2a-r ~$, where $a$ is the semi-major axis.
The angle of incidence equals the angle of reflection $~\angle F_1 P N_1 = \theta - \phi = \angle F_2 P N_2~$, we have
$$\begin{align}
\overline{N_1N_2} &= \overline{N_1P} + \overline{N_2P} \\
&= \overline{F_1P}\cos(\theta - \phi) + \overline{F_2P}\cos(\theta - \phi) \\
&= 2a \cos(\theta - \phi)
\end{align}$$
The length of the horizontal line segment $\overline{Q_1 Q_2}$ is obviously the same as the distance between the two foci, that is
$$\overline{N_1N_2} \frac{1}{ \cos\phi } = \overline{Q_1Q_2} = \overline{ F_1 F_2} = 2\sqrt{a^2 - b^2}= 2c = 2ae$$
where $e < 1$ is the eccentricity of the ellipse.
Hence, we arrive at this nice relation for any point $P$ on the ellipse that
$$\begin{align}
\frac{\cos(\theta -\phi)}{\cos\phi} &= e &&\text{or} &\left|\frac{\hat{\dot{r}} \cdot \hat{r} }{ \hat{\dot{r}} \cdot \hat{s} } \right| &= e
\end{align}$$
where $\hat{r}$ the unit position vector of an orbiting object, $\hat{\dot{r}}$ is its unit velocity (tangent) vector, and $\hat{s}$ is the unit vector along the major axis. Clearly this invariance can be stated in different forms (e.g. with $\vec{r}$ and not $\hat{r}$, with momentum and not $\hat{\dot{r}}$) that might be useful in various physical analysis.
The algebraic derivation of this angle relation is rather tedious, but this invariance along the orbit is so elegant and powerful, bringing many nice geometric results, I wonder why this is not prominently showcased in the physics textbooks (celestial mechanics or just classical mechanics) I've read$\ldots$ or maybe it's just been too long that I don't recognize it anymore.
Now, I'm going to establish a right triangle using the angle relation. Observe in the figure below that
$$\overline{CP} = \overline{QP} \frac{1}{ \cos\phi } = \frac{r}{ e\cos\phi }$$
since point $P$ being on the ellipse means $~\overline{PF} = e\cdot d(P, \Gamma) = e\cdot \overline{QP}~$,
where $~d(P, \Gamma)~$ is the distance between point $P$ and the directrix $\Gamma$.

At the same time, $~\angle CPF = \angle QPF - \angle QPC = \theta - \phi~$ therefore
$$\begin{align}
\overline{CP} \cdot \cos(\angle CPF) &= \overline{CP} \cdot \cos(\theta - \phi) \\
&= \overline{CP} \cdot e\cos(\phi) \\
&= \frac{r}{ e\cos\phi } \cdot e\cos(\phi) = r = \overline{FP}
\end{align}$$
Namely, this proofs that it is a right angle at $\angle CFP$, and we have the angles as labeled in the figure.
We can proceed to the relation involving the semi-latus rectum $~p=\overline{FB}~$:
$$\overline{FB} \cdot \frac{\cos\phi}{ \sin\theta } = \frac{\overline{FB}} e \frac{\cos(\theta - \phi) }{ \sin\theta } = \overline{AB} \frac{\cos(\theta - \phi) }{ \sin\theta }$$
since again for point $B$ on the ellipse $~\overline{BF} = e\cdot d(B, \Gamma) = e\cdot \overline{AB}~$.
With the angle $\angle CFB = \theta$ we continue with the ratio
$$ p \cdot \frac{\cos\phi}{ \sin\theta } = \frac{\overline{AB} }{ \sin\theta } \cdot \cos(\theta - \phi) = \overline{CF} \cdot \cos(\theta - \phi) = \overline{FN} \tag*{**Q.E.D**}
$$