
In the picture, $P$ is the plane, $C$ is the center of the Earth, $B$ is the point on the surface of the Earth directly below the plane, and $H$ is (a point on) the horizon. Our goal is to find $\ell(PH)$, i.e. the length of $PH$, i.e. the distance form the plane to the horizon.
Note that the line $\overline{PH}$ must be tangent to the surface of the Earth: a point on the horizon is the farthest point that can be seen from a given vantage point. If $\overline{PH}$ were not tangent to the surface of the Earth, then there would be another point on the Earth farther from the plane that could be seen from the plane, which is a contradiction.
Since the line $\overline{PH}$ is tangent to the surface of the Earth, we know that $\angle CHP$ is a right angle (radii and tangents passing through the same point on a circle are always perpendicular; this takes a little bit of proving, but essentially follows from a clever application of the Pythagorean theorem). Moreover, we know the lengths of the segments $CB$ and $CH$ (these are radii of the Earth), and $BP$ (this is the altitude of the plane. Therefore, as $\triangle CHP$ is a right triangle, we can apply the Pythagorean theorem to get
\begin{align}
\ell(CH)^2 + \ell(PH)^2 = \ell(CP)^2
&\implies (3960\text{ miles})^2 + (x)^2 = (3960\text{ miles} + 39000\text{ ft})^2 \\
&\implies x = \sqrt{(3960\text{ miles} + 39000\text{ ft})^2 - (3960\text{ miles})^2}.
\end{align}
Since there are 5280 feet in every mile, we can convert feet to miles via the computation
$$ 39000\text{ ft} = 39000\text{ ft} \cdot\frac{1\text{ mile}}{5280\text{ ft}} \approx 7.386\text{ miles}.$$
Plugging this back into the previous equation (and simplifying the units a bit), we finally get
\begin{align} x
&\approx \sqrt{ (3960 + 7.386)^2 - (3960)^2 }\text{ miles} \\
&\approx \sqrt{ 2(3960)(7.386) + (7.386)^2} \text{ miles} \\
&\approx \sqrt{ 58497.12 - 54.55 } \text{ miles} \\
&\approx 242 \text{ miles}.
\end{align}