A more exact formula for distance from the viewpoint to the horizon, applicable even for satellites, is

where R is the radius of the Earth (R and h must be in the same units). This formula follows directly from the Pythagorean Theorem (a right triangle can be drawn with vertices at the center of the Earth, your eyes, and the point on the horizon. If h is in meters, h < < R and R is about 6378 km, then the distance in kilometers will be approximately
.
This formula is not exact since it assumes a constant earth radius.
Another relationship involves the arc length distance s along the curved surface of the Earth to the bottom of object:

Solving for s gives the formula

The distances d and s are nearly the same when the height of the object is negligible compared to the radius (that is, hR).
Geometrical horizon distance
Optical adjustments and objects above the horizon
To compute the height of an object visible above the horizon, compute the distance-to-horizon for a hypothetical observer on top of that object, and add it to the real observer's distance-to-horizon. For example, standing on the ground with h = 1.70 m, the horizon is 4.65 km away. For a tower with a height of 100 m, the horizon distance is 35.7 km. Thus an observer on a beach can see the tower as long as it is not more than 40.35 km away. Conversely, if an observer on a boat (h = 1.7 m) can just see the tops of trees on a nearby shore (h = 10 m), they are probably about 16 km away.
Note that the actual visual horizon is slightly farther away than the calculated visual horizon, due to the atmospheric refraction of light rays. This effect can be taken into account by using a "virtual radius" that is typically about 20% larger than the true radius of the Earth.