The second law of thermodynamics requires, among other things, that although work can be converted directly to heat, heat cannot be converted back to work without the use of a special device. These devices are known as "heat engines".
Heat engines take heat from a source, cyclically convert part of that heat into work (usually in the form of a rotating shaft), and eject the remaining heat to a sink. According to the Kelvin-Plank statement, no engine can exist that does not eject part of its heat as waste.
The cyclic part of the process is the "engine" part. An example of such an engine is the steam power plant - an external combustion engine. Heat from an energy source enters a boiler, where water exists at a high temperature and pressure. The water moves from the boiler to a turbine, which produces a work output, cooling and expanding the water in the process. The water continues to a condenser, where the water cools even more and (hence the name) condenses, expunging heat to a sink. Then the water is driven through a pump, which uses work input to pump the water back to the boiler, again at a high temperature and pressure - and the cycle starts again. Hopefully, the work output from the turbine is quite a bit more than the work supplied to the pump.
This is governed by the following equations:
Work (net, out) = Work(out) - Work(in)
and (because this is a closed system - no mass leaves, no change in internal energy)
Work(net, out) = Heat(in) - Heat(out)
where Work(net, out) = Work(out) - Work(in)
The thermal efficiency of a heat engine is defined as the ratio of the work output to the heat input: Work(net, out)/Heat(in).