When the lava lamp is turned on, the heat causes the solid waxy substance that becomes lava to thicken and expand. What occurs during this process is very scientific: the globs of lava become less dense than the liquid that surrounds it. This causes the lava to begin rising to the top of the lamp.
The light source for a lava lamp is located on the bottom and the farther away from this heat that the lava flows, the cooler it gets. As the lava begins to cool, the density changes again. Although the lava will not cool enough to go back to being a solid again, it does get cool enough so that it is now denser that the liquid surrounding it, causing it to begin to sink back down toward the bottom.
The reason that the blobs of lava appear to continually dance from the top to the bottom of the lamp is because the process will continue as long as the light source is turned on. Once you turn the lamp off and take away the source of heat, the lava cools enough to become a solid again and will rest at the bottom until the lamp is turned on again.