Thermal Equilibrium
Thermal equilibrium is when there is no longer a flow of energy between two objects. If a piece of ice is placed in a glass of water that is at room temperature, thermal energy will flow from the water to the ice. Eventually the ice and the water will be at the same temperature. At this point, thermal equilibrium has been established. When two substances are mixed or in contact, heat lost by one substance is equal to the heat gained by the other substance.
The zeroth law of thermodynamics states that if two thermodynamic systems are each in thermal equilibrium with a third, then they are in thermal equilibrium with each other.
The first law of thermodynamics states that energy cannot be created or destroyed but only transformed into other forms of energy. The total energy of a system is always a constant.
Heating and Cooling Curves
When a substance is heated, the temperature of the substance is directly proportional to the thermal energy that has been put into the substance by some external source. This is assuming that the substance does not change phase, has constant mass and the rate of thermal energy input is constant.
A key point above is that the substance does not change phase. In the diagram below a graph of time vs temperature demonstrates the changes between the different states of water. Note that the graph is flat during a phase change. This is because the thermal energy during a phase change goes into breaking the intermolecular bonds between particles rather than increasing the kinetic energy of the particles.