Original: During the 19th century, the second law was synthesized, essentially, by studying the dynamics of the Carnot heat engine in coordination with James Joule's mechanical equivalent of heat experiments.
Simplified: A heat engine is a mechanical device that provides useful work from the difference in temperature of two bodies.