Snakes do not have eyelids; instead they have specially adapted scales over their eyes called eye caps (also known as spectacles). These are normally shed along with the skin during each shed cycle, but sometimes they do not shed properly -- a condition called retained eye caps.
Causes of Retained Eye Caps
A common cause of retained eye caps is insufficient humidity or other husbandry issues that contribute to shedding problems. However, snake mites or infections of the eye or surrounding tissues may also contribute.
Determining if Your Snake Has Retained Eye Caps
First, always examine the shed skin from your snake. The eye caps should be shed along with the skin, which means there should be no holes where they eyes were. If the eye caps were are not present on the shed skin, it's possible they fell away separately, but you should have a close look at your snake's eyes as they eye caps may still be on your snake. Normally snakes have clear eyes, except for a short period prior to shedding where they turn a milky blue color. If the eye caps are not shed, your snake may appear to have cloudy or foggy eyes. However, the appearance of eyes with retained eye caps is variable, and not all abnormal looking eyes have retained eye caps, so when in doubt consult a veterinarian. For a detailed explanation of detecting retained eye caps, see Reptile Eye Care Issues (external link).
If Your Snake has Retained Eye Caps
There are mixed opinions in the herp community about the necessity of removing retained eye caps (as opposed to leaving them to come off with the next shed); your best bet is consult with your reptile veterinarian. Usually an attempt is made to remove retained eye caps, as they could potentially impair your snake's vision (which may make it nervous, aggressive, or reluctant to feed). Certainly, eye caps that are retained through subsequent sheds need veterinary attention.
If the eye caps are retained, you must re-evaluate your husbandry methods, particularly humidity levels. Your vet can check your snake for other possible causes of retained eye caps as well.
Removing Retained Eye Caps
It is best to get the help of a reptile veterinarian to remove the eye caps, as it is important not to do anything that could damage your snake's eyes. Soaking the snake in warm (not too hot) water a couple of times a day (e.g. just deep enough to cover your snake's body, and supervise to prevent drowning) may help the eye caps come off. However, if this isn't successful after a day or two, a trip to the vet is in order. You will find different methods described online for removing retained eye caps, but I don't recommend trying this yourself, at least until have experience with it, due to the risks of damaging the eye.
Reference and Recommended Reading:
Reptile Eye Care Issues by Stephen L. Barten, DVM.