At the moment of a lightning strike the air at every point along the bolt explodes, making a sound (a loud explody sound). When a lot of the bolt is all about the same distance away you hear a “boom”. 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). So (were you so inclined), you could actually get some idea of what a lightning bolt is shaped like, just by listening. By the way, the “5 seconds per mile” rule for gauging distance to lightning is surprisingly solid.