Now that we have defined the terms that are important for an understanding of thermodynamics, we can state the laws that govern relevant behavior. These laws, unlike Newton's Laws or Gravity, are not based on new empirical observations: they can be derived based on statistics and known principles, such as conservation of energy. By understanding the laws of thermodynamics we can analyze heat engines, or machines that use heat energy to perform mechanical work.
The First Law
The First Law of Thermodynamics is simply a statement of energy conservation applied to thermodynamics systems: the change in the internal --- for our purposes, this is the same as thermal --- energy (denoted ) of a closed system is equal to the difference of net input heat and performed work. In other words,
Note that this does not explain how the system will transform input heat to work, it simply enforces the energy balance.
The Second Law
The Second Law of Thermodynamics states that the entropy of an isolated system will always increase until it reaches some maximum value. Consider it in light of the simplified example in the entropy section: if we allow the low entropy system to evolve, it seems intuitive collisions will eventually somehow distribute the kinetic energy among the atoms.
The Second Law generalizes this intuition to all closed thermodynamic systems. It is based on the idea that in a closed system, energy will be randomly exchanged among constituent particles --- like in the simple example above --- until the distribution reaches some equilibrium (again, in any macroscopic system there will be an enormous number of atoms, degrees of freedom, etc). Since energy is conserved in closed systems, this equilibrium has to preserve the original energy total. In this equilibrium, the Second Law --- fundamentally a probabilistic statement --- posits that the energy will be distributed in the most likely way possible. This typically means that energy will be distributed evenly across degrees of freedom.
This allows us to formulate the Second Law in another manner, specifically: heat will flow spontaneously from a high temperature region to a low temperature region, but not the other way. This is just applying the thermodynamic vocabulary to the logic of the above paragraph: in fact, this is the reason for the given definition of temperature. When two substances are put in thermal contact (that is, they can exchange thermal energy), heat will flow from the system at the higher temperature (because it has more energy in its degrees of freedom) to the system with lower temperature until their temperatures are the same.
When a single system is out equilibrium, there will be a net transfer of energy from one part of it to another. In equilibrium, energy is still exchanged among the atoms or molecules, but not on a system-wide scale. Therefore, entropy places a limit on how much work a system can perform: the higher the entropy, the more even the distribution of energy, the less energy available for transfer.