Well, there was a lot of luck.
Matt and I were on an Exodus overland truck. After an afternoon playing volleyball in the pool by the side of the hippo and croc-infested Luangwe River we saw a storm whipping up. We both rushed to get our tripods and cameras and setup on the veranda. I set lowest ISO, aperture priority and the narrowest aperture (f22 upwards, depending on the lense). Once I had a 30s exposure I just kept pointing the camera at the lightning and clicking away.
The lightning was actually quite a long way away so a mid-range telephoto was needed. Unfortunately it also covered the whole sky - so I actually got lightning in the frame in a tiny percentage of the shots I took. This was one of the first and easily the best - in the other frames in which I captured lightning it wasn't as elegant or dramatic as this.
I had in-camera noise reduction enabled on my camera which meant every 30s exposure actually took 1 minute which was frustrating but I didn't have the confidence or experience to turn it off.
I stood there for more than an hour, repeatedly pressing the shutter, as the storm raged around me. Matt, alas, had to leave early as he was on cook duty. He got better Hippo photos though.
Extrapolating from this experience, you need a camera with a bulb (B) setting allowing more than 30s exposure and a cable or wireless release. I'm not sure if my EOS 20D had a B setting but if it did I had no way to control it - I was firing the shutter with the countdown timer.
There's a series of stunning postcards of table mountain with lightning shots - one here ...
I can only think these were taken with exposures of several minutes, which may mean a narrower aperture than many cheaper DSLR lenses will offer, although possibly not. From memory this shot will have been taken with a wide angle lens so no need to chase the lightning around the sky - just sit and wait. Not sure if you can do any sensible exposure calculation when it's that dark - maybe you can using a light meter - but at that point every stop exposure represents such a long time you'd probably get decent results just guessing.
Similar thing with fireworks really, although I've found shorter exposures can work well in that case and longer exposures tend to burn out as there are too many fireworks in the same place.