So even if your build platform is slightly unleveled, the firmware will make small adjustments to the Z-axis while you print to ensure the nozzle is always the perfect distance away from the print bed. While printing, the printer’s firmware will actively use this information to adjust the nozzle position as it moves across the bed. This data is then used to compute the actual orientation of your print bed with respect to the nozzle’s movement in the XY axes.
When you initiate the bed leveling process, this sensor will probe several locations on the build platform to calculate the distance between the nozzle and the bed at each point. If your printer supports automatic bed leveling, this usually means that it includes some type or proximity sensor or switch near the tip of the extruder.