a lack of potassium causes twitching (in many cases). Sometimes (not as often), its caused by mild dehydration. Bananas are loaded with potassium so eat 'em up! and wash them down with a few liters of water...then you'll be fine....
sometimes, twitching is due to problems in the central nervous system like tourettes syndrome, parkinsons etc....but the more typical twitching is due to lack of nutrients or hydration.