Heat engines are devices that convert thermal energy into mechanical work by utilizing the temperature difference between a hot reservoir and a cold reservoir. This process involves absorbing heat from the hot reservoir, performing work as the engine operates, and then releasing some waste heat to the cold reservoir. The efficiency of heat engines is limited by the second law of thermodynamics, which states that not all heat can be converted to work, and this principle is exemplified in Carnot's perfect heat engine.