The fitting to a plane is done in one of two ways: best plane and best plane parallel to a coordinate plane. All the currently selected points are processed by a least squares fitting algorithm that determines the best plane in 3D space that passes through these points. When that plane has been determined, all the points are dropped to that plane at the closest point. The end result is a set of points that all perfectly lie on a 3D plane. If you choose a set of points that are not very plane like (i.e. all the corners of a cube) it will still try its best to fit a plane to them and then modify all the points so they lie on that plane.
When plane fitting is complete a dialog will appear showing you the fitting error in the current project units. This error is the root mean squared error (sort of like an exaggerated average error) between the computed plane and the 3D points. If this error is too large the fitting might not have worked as expected (perhaps some incorrect points are selected). In this case you can cancel and no changes will be made to the selected points.