According to the second thermodynamics law, energy within a system can be transferred from a hot to a cold object because every isolated system tends to become disordered over time. The molecules in a cold object become more disordered by gaining heat through the processes of conduction, convection or radiation.
The molecules within a hot object tend to be more disordered with a higher kinetic energy. This means they move around more rapidly and undergo more frequent collisions with other molecules. When the molecules of a hot object collide with those of a cold object, the kinetic energy is transferred from the hot molecule to the cold molecule, thus increasing the kinetic energy of the molecules in the cold object. The change in average kinetic energy of the molecules is recorded as a change in temperature.
Heat energy can be transferred from a hot object to a cold object through conduction, convection or radiation, depending on the materials that the objects are made of as well as on the distance between them. Solids transfer heat through conduction where the two objects must be in contact with each other in order to allow collisions between the molecules and a transfer of kinetic energy. Liquids and gases transfer heat through convection, where an increase in kinetic energy of the molecules causes them to move further away from each other, thus decreasing the density of the fluid. This is the reason that warm fluids tend to rise and cold fluids tend to sink.
Heat can also be transferred across long distances without the use of molecules through radiation in the form of electromagnetic waves. Their energy increases the kinetic energy of the molecules in cold objects, which is measured as an increase in temperature.