What mathematical formula does Blender use to calculate Bezier paths?
For each segment of the path between two control points, it approximates a cubic Bezier curve:
where P_0 and P_3 are the control points and P_1 and P_2 are the handles.
Even though this isn't a question about Blender's code exactly, linking to blenders code for calculating cubic bezier curves may help understanding.
3D curves use an optimized subdivision method:
2D masks can also use a different (more straightforward but slower) method where you can get any point on along the spline:
To see how this method works, see wikipedia's descritoion of Higer order curves