Exact implementations vary, but it's mostly about reverse-engineering a sphere.
When you mount a tool to a robot, the robot knows nothing about that tool's dimensions. However, what the robot does
know, by design, is the location of it's "zero tool" -- that is usually the center of the mounting flange where end effector tooling is mounted to the robot. Because this point is part of the robot, the robot always knows where this "zero tool" is located in space, relative to the robot base, from the forward kinematics of the various axis angles.
So, when you perform a tool calibration by (on most robots) touching the tool tip to the same point in space from four different angles, the robot knows nothing about the tool, or the point in space you're touching. But it does
know the location of the "zero tool" at each of those four measurements. This then becomes a problem for determining the center of a sphere from points on its surface:http://math.stackexchange.com/questions/894794/sphere-equation-given-4-pointshttp://stackoverflow.com/questions/13600739/calculate-centre-of-sphere-whose-surface-contains-4-points-chttps://www.safaribooksonline.com/library/view/engineering-mathematics/9789332515611/xhtml/chapter011-02.xhtml
The center of the sphere is the fixed point in space being used as the reference for the tool tip, relative to the robot base. At that point, it becomes a matter of finding the XYZ transform that, using the "zero tool" as the point of origin, will make the transition from the spatial location of the "zero tool" at each of those measurement locations to the reference point.
Technically, in a perfect world, any one of these 4 points would be enough to determine the tool dimensions relative to the "zero tool," once the reference point (sphere center) has been determined. However, since the robot is an imperfect device, the algorithm performs this transform/fit calculation for all 4 measurements, and attempts to average their results. If the error range between the four measurements are too great, the robot decides that the measurements were insufficiently precise and throws an error, usually telling the operator to start over and try again.