Lamp knocked over
If you just knocked over your lamp the best thing you can do at this point is to turn it off and leave it alone. Depending on how bad it is shaken up you may have to go to more advanced fixes. You should leave it alone for at least 7 full days. Once the 7 days has passed look at it and evaluate its condition. Is there still a lot of stuff floating around in it? If yes leave it for longer. If it just looks cloudy run it and see how it flows. If it is still cloudy after a few runs keep reading
Most American made Lava Lamps can be fixed by simply running the lamp. The lamp can be put on a timer to run the lamp for you. Set the timer to run the lamp for 6 hours on (or as long as it can be run without overheating), and 6 hours off. Run this cycle until the cloudiness goes away. You should notice a ring of white residue start to gather around the side of wax at the bottom of the lamp while it is running. This residue should go away when the lamp cools off. This residue is what is clouding the lamp.
The lamp pictured to the right will clear up after being ran enough times.
If the cloudiness does not go away after a month, then there might be a more severe problem with the lamp. Some will clear up better if you let them sit in a cold place for a while. It depends on the reason the lamp is cloudy and the age of the lamp. If you are the owner of a second hand lamp it's hard to determine what the best course of action is.
If the lamp is a China made lamp it may never clear up. The same methods can be tried as if it were an American made lamp but your results may not be as good. Newer China made lamps have responded better to filtering after being ran enough times, but filtering seems to change the flow of the wax for the worse.
When buying second hand lava lamps it is common to find lamps that have been knocked over at some point and then left to sit for years and sometimes even decades. Sometimes these lamps respond well to what is known as a boil. A boil is simply removing the liquid from the lamp and heating up the wax to higher than normal temperatures. Believe it or not they eventually clear up and after a run or two the emulsion formed by the lamp being shaken up precipitates out of the master fluid and settles on the bottom. When the lamp is turned on the chemicals that separated from the wax are reabsorbed into the wax. Unfortunately they do not form a proper mixture with the wax at normal operating temperatures. This results in a handful of problems. Wax can look chunky, fill with bubbles, and only flow in a single column like pictured below.
Note on vintage lamps from 1960-1989.
I don't know if I would recommend this process due to the fact that lamps from this time period use perchloroethylene to make the wax more dense. Boiling the wax will cause the perchloroethylene to volatilize and leave the wax formula. This may make the lamp stop flowing normally. You also will be breathing in perchloroethylene. Proceed with your own risk and wear a respirator rated for organic solvents like a 3M 6001.
Likely knocked over at some point posted on ebay.
To begin while the lamp is cool pour the liquid into another clean container, but make sure to leave a small amount of fluid so the wax does not stick to the globe. Only an oz or two should be left. You can store the liquid in mason jars that are either new or have been cleaned out with acetone and then distilled water and left to air dry.
Put a small plate at the bottom of a pan to prevent the globe from cracking due to the extreme heat of the bottom of the pan. DO NOT SKIP THIS STEP! Some people do and I have seen posts on here where they cracked their globe because they didn't listen to this warning. Fill the pan up so the water level is equal to the wax level in the globe. Bring the liquid to a full boil until all of the wax is melted. Let the lamp heat up for an additional 10 minutes. Let the lamp cool off completely then re-pour the fluid back into the lamp.