The second law of thermodynamics states:
for any spontaneous process, the entropy of an isolated system can only increase or stay the same, but never decrease.
The entropy is a property of the system that measures the disorder in a system. For example when you add a drop of black ink into a glass of water, the ink disperses making the water grey and cloudy- the system is now more disordered. Likewise, when heat is added to a system, disorder or entropy increases; but when heat flows out of the system, entropy decreases.
In this second law, heat can not flow from a cold object to a hot one, but allows it to flow the other way around, from the hot to the cold object. It implies that in an isolated system, energy will disperse over a certain period of time, leaving less energy available to do useful work.
There are 2 important statements that follow this law:
1. Heat can flow spontaneously only from a hot source to a cold sink. 2. No heat engine can be constructed in which heat from a hot source is converted entirely to work. Some heat has to be discharged to a sink at a lower temperature.
The second statement brings us to the fact that 100% efficiency in a system is impossible- which is where Carnot efficiency comes in.