I take on board what others are saying, including sarah bookworm's sodium, potassium, calcium comment, perhaps also magnesium and other minerals. But the more water coffee or tea you drink, the more you flush these things out of your system. A serious mountaineer guy who I met said you need one packet of salty crisps for each pint of beer! (Thats not a recommended diet!) And whatever the experts say, some cramp IS related to lack of electrolytes and/or over-hydration. Yes, also stretching and especially warming up - Sarah's right.
I have suffered with unexpected cramp in an important (to me) race, and gradually realised over the next year or so that it was caused by drinking too much water and coffee without sufficient salt and other electrolytes. I now carbo-load the day before or at breakfast on pasta, toast or cereal followed by some salty snack and an electrolyte drink (sometimes with extra added salt!). But having got your body-weight down for a big race you dont want to feel bloated on the day, so make that breakfast small. You dont need loads of fluid or calories for a half marathon. One small gel 5 minutes before the start is probably enough, possibly one at halfway.
Lots of good stuff written here. My own unscientific experience is that some sort of knee-length socks AFTER a hard workout does help my calfs recover. But I'm very prone to DOMS ...delayed onset muscle soreness... in that part of the leg. Oh, and as I do triathlon, the tight-fitting tops help reduce my wind-resistance on the bike, especially into a headwind. But mainly, yes, another ploy for the companies to extract money. Good compression socks are available in cheapo supermarkets every now and then for a couple of pounds. And lycra tops are cheap. Train harder and enjoy our simple sport !