Heat does not flow from cold to hot by itself, and no engine converts heat entirely into work. The second law is the most secure statement in physics, and it is the only fundamental law that distinguishes the future from the past.
The law has multiple formulations that turn out to be equivalent, which is part of the evidence for its depth.
Clausius: heat cannot pass spontaneously from a colder body to a hotter one. Kelvin: no process can convert heat entirely into work with no other effect. The entropy statement: the total entropy of an isolated system never decreases.

Clausius introduced entropy in 1865, defining its change as heat transferred divided by temperature. The definition was thermodynamic and made no reference to atoms, which at the time were not universally accepted as real.
Ludwig Boltzmann gave the concept its physical meaning in the 1870s. Entropy counts the number of microscopic arrangements consistent with a macroscopic description.

A gas filling a container has vastly more arrangements available than the same gas confined to one corner, because there are vastly more ways to place molecules throughout a volume than within a fraction of it. The gas spreads out not because it is driven to but because the spread-out arrangements outnumber the confined ones overwhelmingly.
The relationship is logarithmic, and Boltzmann's formula for it is carved on his gravestone in Vienna.
This reframes the law entirely. It is not a force or a compulsion. It is a statement that improbable configurations are improbable, applied to systems with enormous numbers of components. The probability that the air in a room spontaneously gathers in one half is not zero; it is a number so small that waiting for it would outlast the universe by an incomprehensible margin.
Every other fundamental law of physics works equally well run backwards. Newton's laws, Maxwell's equations, general relativity and quantum mechanics contain nothing distinguishing past from future. A film of two billiard balls colliding looks correct in either direction.
A film of a cup shattering does not. The second law is the source of that asymmetry, and it is the reason the concept of a direction of time has any physical content.
This creates a real puzzle, since an asymmetric conclusion is being derived from symmetric underlying laws. The resolution generally accepted is that it is not derived from them alone: it also requires that the universe began in a state of extraordinarily low entropy. Given such a beginning, entropy increase follows statistically. Why the early universe was in that state is unresolved, and is one of the significant open problems in cosmology.
The law rules out perpetual motion machines of the second kind: devices extracting work from a single heat reservoir. Such a machine would violate no conservation law, and it is forbidden nonetheless. Patent offices in several countries refuse applications for them without examination.
Carnot's result, which preceded the law and prompted it, sets the maximum efficiency of any heat engine by the ratio of its operating temperatures. No engineering can exceed it, and the limit is why power stations reject large amounts of waste heat regardless of design.

The claim that evolution or the growth of an organism violates the second law is raised regularly and rests on a misreading.
The law constrains isolated systems. The Earth is not isolated: it receives concentrated energy from the Sun as visible light and radiates it away as a far larger number of infrared photons. The entropy exported vastly exceeds the local decrease represented by a growing organism or an evolving lineage. Local order is paid for, and the accounting is not close.
Arthur Eddington's remark is the standard statement of its status: a theory contradicting the second law, he wrote, has no hope but to collapse in deepest humiliation.
The confidence is warranted because the law does not rest on any particular physical mechanism. It rests on counting, so it holds for any system with many components regardless of what those components are or which forces act between them. That generality is why it survived the transitions to relativity and to quantum mechanics untouched, and why it constrains black holes, computation and information as readily as it constrains steam engines.