In the US, according to the National Oceanic and Atmospheric Administration, lightning kills an average of 66 people a year: more than volcanoes or hurricanes, fewer than floods, but still 66 too many. But lightning is one of the most preventable deaths. The solution is to either get indoors (and stay away from wires and windows) during a thunderstorm or, if you cannot manage that, lie down. The electricity is looking for the fastest route between Earth and sky and will ignore you if it can find a better way.
Lightning forms in turbulent clouds containing a lot of ice. The particles rub against each other and collect opposite charges of static electricity. The positively charged ice accumulates nearer the top of the cloud and the negative near the bottom.
Many lightning strikes occur within or between clouds, connecting and equalizing these areas of opposing charge. Those that hit the ground do so because the negative charge in the cloud attracts positive charge on the ground below until a conducting channel opens between the two. Then two things happen. A big current – lightning – flows through the temporary conducting channel of air. And the heat of the passing current expands the air so fast that it generates a shock wave that you hear as thunder.