I'll go with muscle fatigue being the trigger. The last time I cramped was when I rode the Davis Double last month. The cramps came just before the rest stop 3 miles before the summit of Cobb Mountain, so after about 100 miles. I'm riding a fixed gear, out of the saddle in 44x17 on a continuous steep grade, must have been 15% or more for several miles. I don't drink much (I carry only one regular-size bottle on these rides since the rest stops are so close together), but I drank even less at Borrego the following week where there is about three times more climbing and I did not cramp there. Davis was much warmer than Borrego, but otherwise the only variable that changed was the degree of effort on that one long, steep climb.
So I would say that the best way to avoid cramping is to ease off a little when you start feeling the little twinges. And then just increase training volume or intensity. I normally get in three or four hundred kilometers per week, about 20,000 km per year, most of it fairly low intensity since I stopped racing. And even with that I'm cramping up on extended intense efforts. But that's what makes getting over Cobb and finishing challenging rides so satisfying.
Luis