Why doesn't lightning travel in a straight line?

Supposedly the shortest distance between two points is a straight line. I always that that lightning was buildup of electrical energy that arced between the point where it built up in the atmosphere and the most available point. If that point is on earth why doesn’t the lightening go straight there instead of oftentimes taking a lot of weird angles?

It’s interesting to watch but I’d like to know why it looks like it does.

Imperfections in the air such as dust, interference from the earth’s magnetic field, irregularly shaped origin or destination, etc.

Lightning has two stages. There’s a faint downward stroke that fans out in all directions, and then a strong upward stroke when one of the many tendrils of the downward stroke finds ground. The jagged path of the upward stroke reflects one path backwards through the initial tree of tendrils.

It’s going along the path of least electrical resistance. As said, the downward tendrils “feel” their way down, moving though low resistance spots in the air and around higher resistance areas*; then the big upward bolt flashes through the ground-to-sky path one of them has established.

*For a rough analogy, imagine a trickle of water flowing down a rough sloped surface; it flows around the bumps, and through the indentations.

While the shortest distance is a straight line, electricity is more interested in the path of least resistance. Which will be affected by the above mentioned dust and debris in the atmosphere and other factors that I’m not up to speed on.

there is so much energy to dissipate that it has to take multiple paths.

the example of water dumped on a dirt pile is a good one. the flow goes where it can, when it can, if it finds resistance it finds a way. it goes until it’s all as low as it can go.

See Lichtenberg figure, of which lightning is one kind.

Another feature of the water-on-dirt analogy: Once the water starts flowing down a particular path, it’ll tend to wear away the dirt along that path, which in turn makes it easier for more water to continue to follow that path. Similarly, the path the lightning takes initially will become ionized from the heat, which will make it more conductive, which will make the stroke continue to travel along that path.