There are two main types of eyelid twitching.  Blepharospasm is an exaggerated, involuntary blinking of one or both of your eyes that is very obtrusive to your daily life.  This is a medical disorder that can be treated usually with Botox injections into the spastic muscle.
The more common type of eyelid twitching involves usually just the upper or lower lid of one eye that begins to twitch rapidly but not in an exaggerated fashion.  It can last minutes or hours but it typically resolves on its own.  Factors that can increase the frequency for this type of lid twitch include dry eyes, excessive fatigue or lack of sleep, and stress.