So it’s kind of a complicated process, but here’s the two-sentence version: Lightning is an electric current that takes the path of least resistance from the base of a cloud to the ground. Since the air it travels through is not uniform—variations in things like temperature, humidity, and pollutants determine how resistant air is to the charge—the lightning has to zig and zag to stay on that path.