Sphere or ellipsoid?
The quick answer treats the earth as a sphere and uses the haversine formula, with φ for latitude, λ for longitude and R for the radius:
a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2); d = 2R · atan2(√a, √(1−a))
But the earth is flattened at the poles by about 1 part in 298, so a sphere is off by up to about 0.5%. From London to New York the haversine answer, with the mean radius of 6,371.0088 km, comes out about 15 km short of the ellipsoidal 5,585 km.
Ellipsoidal methods solve the problem on the WGS84 ellipsoid itself. Vincenty's formula (1975) iterates to millimetre accuracy but can fail to converge when the points are almost opposite each other on the globe; try the "nearly antipodal" example. Karney's algorithm (2013) always converges and is accurate to about 15 nanometres, so it is the reference here.