A 3D printer has various microswitch sensors that are read by the printer's mainboard to determine the position of the print bed and the print head(s). There are also filament sensors to monitor whether the filament runs out halfway through the print and to pause the printer if necessary.
A temperature sensor in the hotend ensures that the 3D printer reaches the correct temperature to melt the filament and print properly.