Heat transfer occurs by three main mechanisms: conduction, where rigorously vibrating molecules transfer their energy to other molecules with lower energy; convection, in which the bulk movement of a fluid causes currents and eddies that promote mixing and the distribution of thermal energy; and radiation, where a hot body emits energy that can act upon another system via electromagnetic waves. Convection and conduction are the two most prominent methods of heat transfer in liquids and gases.
Conduction typically occurs in solids. Electric stove tops use conductive heat transfer to bring a pot of water to a boil: thermal energy is transferred from the hot burner to the cool pot, causing the water's temperature to increase. Conduction happens because of the vibration of molecules. In a solid substance, atoms, arranged very tightly in lattice-like structures, have very little freedom to move around in space. As the burner heats up, the atoms in the metal begin to vibrate faster and faster as their energy increases. When you place the cool pot of water on the burner, you are creating a temperature gradient -- a place for the heat to flow to. Since energy flows from hot things to cooler things, the vibrating atoms of the burner transfer some of their heat to the atoms that make up the metal of your pot of water. This causes the pot's atoms to vibrate, transferring their energy to the water.
Conduction in Gases and Liquids
Conduction is more common to solids, but in principle it can -- and does -- happen in liquids and gases, just not very well. Because the molecules of fluids have a greater freedom of motion than in solids, there is less of a chance that vibrating molecules will collide with another and transfer energy throughout the fluid. In fact, air is such a poor conductor that it is used to help insulate homes. Some energy-efficient windows have "air spaces" between them that create a pocket of air between the inside of the home and the cold outside air. Because air does not conduct heat very well, more heat stays inside the home since the air makes it difficult for this thermal energy to make its way outside.
Convection is by far the most efficient and common way for heat to be transferred through liquids and gases. It occurs when some regions of a fluid get hotter than others, causing currents in the fluid that move it around to distribute that heat more evenly. Think of a house in the winter time. You may have noticed that the attic is always very warm while the basement is typically cool. This happens because when air heats up, it becomes light, causing it to move up towards the ceiling. Cold air is much heavier and falls to the floor. As the hot air moves to the ceiling and the cold air falls, these two types of air collide and mix, causing the heat from the warm arm to transfer to the cooler air and thus distributing the heat throughout the room.
Radiation occurs when a body gets hot enough to emit electromagnetic energy. The sun is a classic example of radiative heat transfer: it is very far away in space, but it is hot enough for your to feel its heat. You feel this heat because of radiation, and even on a cool day the sun feels warm. Electromagnetic energy can travel through empty space and can cause a target object to heat up from far away. Radiative heat transfer does not commonly occur in liquids and gases.