Physicist: The speed of light (which governs how long it takes to see lightning) is about one million times faster than the speed of sound (which governs how long it takes to hear lightning), so for the purposes of this post you can consider light to be instantaneous.
At the moment of a lightning strike the air at every point along the bolt explodes, making a sound (a loud explody sound). But while all the sound is generated at the same moment, lightning bolts tend to be very long (generally several miles), so you don’t hear it all at once.
When a lot of the bolt is all about the same distance away you hear a “boom”. When only a little of the bolt is a particular distance away you hear a rumbling. Another way of saying that is: when you hear the sound from a lightning bolt that’s pointing toward/away from you, you’ll hear a softer rumble because you’re only hearing one point of the lightning bolt (middle picture above). When you hear the sound from a lightning bolt that’s running side-to-side in front of you, you’ll hear a “crack” or “boom” because the sound from a lot more of the bolt will reach you all at once (left and right pictures above).
So (were you so inclined), you could actually get some idea of what a lightning bolt is shaped like, just by listening. Since the sound depends on the side-to-side-ness vs. the toward-away-ness, and that changes with your vantage point, people in different locations will hear a different pattern of booms and rumbles from the same lightning bolt.
By the way, the “5 seconds per mile” rule for gauging distance to lightning is surprisingly solid. It’s accurate to within about 6%, which isn’t terrible!