Don't let that moment of panic set in when you find the lid of a pot or pan simply won't come off. There are typically two reasons why the lid becomes stuck: air pressure and old food. Both problems can also happen simultaneously. The solution to both conditions is one of simple science and simple solvents. The method will work for any two items stuck together, which happens often with glassware.
Remove any food buildup around the rim where the lid connects with the pan.
Place a towel over the glass portion of the pot.
Heat the pot with very hot running water or on a low heat on the stove.
Take the lid off when you hear the releasing sound. Contracting cold air is probably what caused the lid to stick. It was being held on through suction; reversing the process expands the air inside the pot and allows your lid to release.
Place the pot upright in a sink or tub.
Clean excess food away from the rim of the pot using dish soap.
Spray the lid with a bleach cleaner until it is soaked. Allow the cleaner to sit for at least 10 minutes.
Scrape away all food with any small tool that is handy; a fork or butter knife will work.
Try to gently remove the lid. After all the food is removed, you may want to try the first solution again if this does not work. A combination of air pressure and dried foods is a possibility, and the heat solution will not work without the food first being removed.