As they collide, the faster molecules give up some of their energy to the slower molecules. The slower molecules gain more thermal energy and collide with other molecules in the cooler object. This process continues until heat energy from the warmer object spreads throughout the cooler object. Some substances conduct heat more easily than others. Solids are better conductor than liquids and liquids are better conductor than gases.
Metals are very good conductors of heat, while air is very poor conductor of heat.
In liquids and gases, convection is usually the most efficient way to transfer heat. Convection occurs when warmer areas of a liquid or gas rise to cooler areas in the liquid or gas. As this happens, cooler liquid or gas takes the place of the warmer areas which have risen higher. This cycle results in a continous circulation pattern and heat is transfered to cooler areas. You see convection when you boil water in a pan.