I noticed that you can get cheap and expensive xlr cables, why would anyone buy the more expensive ones?
Is the only difference how well the cable "age"? Or are there also differences in how well the cable leads electricity?
The things that affect the quality and price of a cable are similar to what affects quality and price for any product: parts and labor. Specifically for cables:
There are other details that matter in cables. Really you have to decide for yourself what you are comfortable with. I am easily frustrated by cheaper cables but other people don’t notice or don’t mind the difference. And still other people insist on cables even more expensive than what I’m willing to use.
Is the only difference how well the cable "age"?
Yes, pretty much. I bought a couple of really cheap mic cables for use at home once (where, I thought, the stresses would be so much less than on stage that it wouldn't matter), but even then they broke after something like a year. Whereas good quality cables can last many years even when used weekly in a less-than-gentle manner on those rough stages.
Or are there also differences in how well the cable leads electricity?
Yes, but they don't really matter because XLR is a well-designed standard (unlike many other audio connections). Concretely, they are balanced so that hum/brizzle etc. interferences are mostly cancelled out, and have a well-chosen impedance that prevents either capacitance (which has a big influence on the very high-Q guitar connections) or resistivity (which swallows power in the very low-Q speaker connections†) to have any significant influence on the transmission★ – at least for reasonable cable lengths; for kilometre-long transmissions you might run into problems but who would need that?
That means in particular that super-premium mic cables, advertised as sounding particularly good, are just bogus. In case of guitar cables those may actually sound different (typically because of very low capacitance, but even then the price is usually not justified because you could just use a shorter cable and/or a suitable buffer), but for mic connections they will sound exactly the same, unless they have some deliberate nonlinearity built in – which, when it actually does improve sound, you should better dial in with a simple equaliser.
Very low quality cables may also have strange sonic effects, like clicks when you step on them, but those are just trash. Any two decent mic cables will not give notably different sound so long as they work at all.
†There are actually good reasons why speaker connections have such low impedance. As long as the connections are kept short, this isn't really an issue (best is to have the power amps right next to the speakers or even inside the (active) speakers).
★This assumes of course that the devices you connect are actually standards-compliant, i.e. have the correct impedance and high common-mode rejection. That's not always a given; in particular, if you use an XLR cable through an adapter as an extension to an unbalanced line one, then the XLR part will also be unbalanced and therefore happily pick up any interference that makes it through the shielding. The correct thing to do here is to use a DI box instead of a plain adapter.
Once you actually hold a good XLR cable, you really can feel the quality in it. You're looking at $3-10 per foot, depending on length (longer is cheaper per foot).
Warranty is also a factor. All cables break eventually. I have some 12 year old cheaper XLR and guitar cables with a life-time warranty. If (when) they break, I can just take them into a local store, and they'll give me a new one.
They'll also do the same with my (much more expensive) cables. The difference is, the expensive cables are heavier duty, and less likely to give out during a gig. I generally carry the expensive ones (and spares) with me, and a couple of cheaper ones as loaners/gifts if someone else has a problem.