The same way water knows the shortest path. The same way gas knows the shortest path.
A huge number of natural processes work on the principle of something flowing to where there is less of it from where there is more of it.
A substance simply going from where there is more to where there is less will naturally do so in the shortest unobstructed path.
It is very convenient to imagine electricity like water. The water doesn’t know where the ocean is but it will find the path to it. It travels down the nearest downward slope because that way has lower gravitational energy. It continue until it finds the lowest energy state it can like the ocean or a depression. It will fill that depression until it overflows into the next area. This is it overcoming the gravitational energy, or resistance, to get over the next obstacle. Sometimes the water can overflow into many areas at once but one of them will allow more water than others and this will erode that path until it is the only path the water takes. Electricity does a similar thing.
Others have already explained how it actually tends to take all the paths, just with different strengths, and probes them in a certain way. But lightning is actually quite a bit more involved still:
The final bolt is clearly not taking the “shortest” path as evidenced by it being zig-zagged even while still in mid-air. It actually finds its path in a stepwise method. The charge wants to go downward (or up) and “sends” little probing charges out. If they are favourable it can jump to them, and then send more probes from the new location. This happens in parallel with multiple paths, forking potentially many times.
At some point one of the probes gets close enough to ground (or whatever else the charge wants to flow into) and establishes a connection. In that moment and only limited by the speed of light, all of the remaining energy of the lightning flows towards the zig-zagged path to that one final node. This is what we then see as the actual lightning bolt! It is highly random, not the shortest route, because each step has some variation, not a unique direction to go.
There is [a very nice video by the Slow Mo Guys](https://youtu.be/qQKhIK4pvYo?si=bx3-AeM1N1N5uqdj&t=301) where you can clearly see the entire process multiple times.
Latest Answers