(1) 
 
where^{'} 

This formula is an approximation: until 550 km or 342 mi the error stays within ∓0.032%. Until 800 km or 497 mi the error is less than 0.1%.
Click in the graph above to get all values for a certain point.
The deviation of the approximated value from the real value is shown in the Calculator Form at ~x  x absolute or as the relative error in % in the orange field (~xx)/x.
This approximation formula can also be used to approximate h, since for distances less than 258.5 km or 160.2 mi the error for h is less than 0.1%. But generally h is always greater than x and the deviation between them grows exponentially.
Sketch 1 shows the values used in the calculator form. Variables preceded with a ~ are calculated using the approximation formulas, all other variables are calculated using the correct formulas.
Strictly speaking x is not the curvature of the earth but the drop from the tangential plane (blue line in Sketch 1) at a distance s from the observer. The curvature k of a sphere is defined as the reciprocal of its radius: k = 1 / r.
The drop x is not what is hidden by the curvature of the earth! This would only be the case if the observers eyes are at the surface. If the observers eyes are at an altitude greater than 0 the hidden part is less than x. In fact if the observer is high enough he can always see the whole object in the distance.
For equations for Hidden Parts see:
Standard Refraction bends light downwards in an arc with a radius of about 7 times the radius of the earth. This means that far objects appear lifted and can come into view from behind the horizon. After sunset, when the ground is cooling faster than the air above, near the ground you can easily get refraction coefficients way beyond 1. [1] Flat earthers alway conduct their laser test very near the ground after sunset over cool water or ice. In such conditions it is expected to see a laser over any distance. Such experiments to prove the earth is flat are flawed, as Strong Refraction at Bedford Targets shows.
A convenient method to analyze the effect of refraction on visibility is to consider an increased apparent radius of the earth R'. Under this model the light rays can be considered straight lines on an earth of increased radius. R' = 7/6 · R corresponds to Standard Refraction, where R = 6371 km is the radius of the earth.
I will derive the exact formulas for h and then x from s and r and then show how the approximation for x is derived from that and why it is accurate enough as long as s is much smaller than r.
First we need the angle a, that can be calculated from s and r. On a circle with radius r = 1 the circumference is 2π, which is also the angle a of the full circle. So the angle a in radian of a unit circle is always equal to the length of a corresponding segment of length s. If we have a circle of radius r instead, we simply have to divide s through r to get the corresponding angle a:
(2) 
 
where^{'} 

The distance d can now be calculated from the angle a and the radius r. The tangent of the rightangled triangle [r,d,r+h] is tan(a) = d / r. Solving for d gives:
(3) 

Using Pythagoras we can now calculate h:
(4) 
We expand the square on the right hand side:
(5) 
The radius squared can be subtracted from both sides:
(6) 
We can rearrange this formual to get a quadratic equation for the unknown h:
(7) 
Inserting d from (3) gives the following quadratic equation for h:
(8) 

To calculate h we can use the method for solving a Quadratic equation. We substitute p = 2·r and q = −[r·tan(s/r)]^{2} to get the normal form of the quadratic equation:
(9) 
Solving the quadratic equation for h gives the two solutions:
(10) 
We are only interested in the positive solution:
(11) 
In our case is p = 2·r and q = −[r·tan(s/r)]^{2}:
(12) 
Factoring out r we finally get a formula for h:
(13) 

Here is another equivalent formula for h:
(14) 

We can see in Sketch 2 that, using trigonometry, x = r − r·cos(a). Factoring out r gives:
(15) 

Note that
(16) 
which can be seen from Sketch 1. This is how (14) is derived.
We can simplify the derived formulas (15), (13) and (14) by taking advantage of the fact that in practice s is much smaller than r. In this case the angle a is very small and we can replace the tan and cos functions by the first 2 terms of the corresponding Taylor series. We will see that in this approximations the length x and h will be the same.
Lets find first an approximation for x from the formula (15):
(17) 
The cos function can be approximated by its taylor series:
(18) 
Note ! is the factorial function: n! = 1·2·3·...·n, so 2! = 1·2 and 4! = 1·2·3·4 etc.
Now if a is much smaller than 1, then a^{4}, a^{6}... are even much, much smaller than 1. So these terms are negligible and we can simplify the cos function because the red terms do not contribute much to the result:
(19) 

The symbol
Lets plug in this into (17):
(20) 
The red 1's cancel and we finally get:
(21) 

We have now seen that for the case that
(22) 


How do we get to 8" per miles squared? We are almost done. We only have to put in the radius of the earth r in miles so the result is in statute miles. Than we multiply by a conversion factor c = 63,360 in/mi to get inches from miles. The constants can be collected together and we get:
(23) 
We round 8.0024 to 8 and finally get:
(24) 
 
where^{'} 

Now lets find an approximation formula for h using the first formula (13):
(25) 
The tan function taylor series is:
(26) 
Now if a is much smaller than 1, then a^{2}, a^{3}, a^{4} ... are even much, much smaller than 1. So these terms are negligible and we can simplify the tan function because the red terms do not contribute much to the result:
(27) 
So if we plug in this into (25) we get:
(28) 
We can even simplify more, if we use the taylor series for √1 + x^{2}:
(29) 
If we plug in this into (28) we get:
(30) 
The red 1 and −1 cancel and we finally get:
(31) 

We can simplify the second formula (14) for h in a similar fashion as shown above.
(32) 
The cos function taylor series is:
(33) 
For small angles a we can omit the red terms, because they do not contribute to the result. If we plug in this into (32) we get:
(34) 
If a ≪ 1 then a^{2}/2 is even much smaller than 1, so we can replace the red term by 1:
(35) 
And we get finally the same result as in the section above:
(36) 

How much of an object is hidden behind the curvature of the earth, the so called hidden height h_{h}, depends on the distance of the object from the observer and from the height of the observers eye above the surface h_{O}. The distance can be expressed as the line of sight d to the object, tangent to the horizon, or as the arc length s along the surface of the earth between observer and target.
Note: To calculate the hidden height you must not use the famous equation 8 inches per miles squared! This equation is an approximation to calculate the drop of the earth surface from a tangent line on the surface at the observer. It calculates not the hidden part of an object.
Depending on whether you know the line of sight distance d or the distance along the surface s the following equations calculate the hidden height exactly:
(37) 

(38) 
 
where^{'} 

The same equations can be used to calculate the hidden height with and without refraction. You simply have to choose the corresponding value for R. Because under standard refraction the earth looks less curved, you can use a bigger radius for the earth than it is in reality. For standard refraction 7/6 · R_{earth} use R = 7433 km. For standard refraction k = 0.17 use R = 7681 km.
There are multiple slightly different values for standard refraction in use. Near the ground the bigger value is more accurate. For higher altitudes the smaller value is more accurate. If you press the button Std the App calculates refraction depending on the observer altitude. Near sea level refraction is about k = 0.17.
The hidden height equations are only valid if the object lies behind the horizon. That is if the distance to the horizon d_{H} or s_{H} is less than the distance to the target d or s.
The exact distances to the horizon can be calculated with the following equations:
(39) 

(40) 
 
where^{'} 

If the observer height h_{O} is much smaller than the radius of the earth R, the Exact Equations for the Hidden Height can be simplified by the following approximation:
(41) 
 
for 
 
where^{'} 

Note: for observer height much less than the radius of the earth, the line of sight distance d and the surface distance s are identical for all practical purposes. So the equation above holds for both cases.
The distance to the horizon can also be approximated by the following equation:
(42) 
 
where^{'} 

Conclusion: For all practical purposes while the observer is within the troposphere, so that the observer height h_{O} is much less than the radius of the earth R, you can use the approximation equations. In this case for the distance between observer and target you can use the line of sight or the distance along the surface. They are practically identical.
As always, absolutely wonderful work. I particularly like that you included the error margins for the approximation (sadly, many of us globers seem unaware of this) and the actual definition of curvature :)
For the record though, there's an easier way to derive (14). From sketch 1 we have
Another nice addition here might be adding the the hidden height formula (both the proper one and approximation). If added to the calculator, it would make it clear just how wrong ignoring it is. IIRC, for a 20 mile distance even an inch of elevation already changes the hidden height by 4%.
cearn, thanks for the suggestion. I added the equations for the hidden height. There are still more ways to derive the approximation equations. But thanks for your example.