What is lightening? It is the electric discharge through the air due to the separation of ions (charges) in the atmosphere. Ions are basically the charges with electric field (not neutralized). The voltage drop can occur across the layers of opposite charges in the atmosphere or the charge accumulations in the atmosphere and the ground.
Ions are developed because of the turbulent flow of clouds due and the resulting friction. You may be familiar with the charge induction process in electromagnetic induction already. The similar thing happens when the clouds strike together and flow vigorously. The lightning also occurs by the formation of "leaders" not well understood. The overall process of how lightning occurs is still under study.
The most favorable situation for the lightning we often see is that the lightening is vertical. Why is that? The Earth's surface is a conductor and it has free electrons. The charged positive ions are in the corresponding layer in the atmosphere, that creates the vertical electric field. If the charge accumulations is large enough, the dielectric strength of the air is overcome and the electric discharge occurs.
Lightning is not always vertical though, it is also horizontal and transverse. As the turbulent flow of air or clouds become so rapid, the charges of opposite sign are quickly developed enough to overcome the dielectric strength of the air in the upper region of the atmosphere, that can cause the lightning in various directions.
The lightning can be attracted to hit a different place instead of hitting somewhere else. The following image shows Empire State Building where the lightning is attracted to hit the lightning rod at the top of the building instead of other nearby places. The use of the lighting rod at the top of the building attracts the lightening. When the clouds with charges pass over it, the charge of opposite sign is induced in the mast, and the lightning is more attracted to hit it.
The lightning rod is a rod with sharp or blunt end connected with thick conducting wire to the ground. There is actually a debate on the sharp or blunt ends. The sharp end rod can have a strong electric field when the charged clouds pass over it and the lightning is more attracted to it. But after the study by Charles B. Moore on the case, blunt ends are preferred.
We all know that the charges always lie on the outer surface of a conductor. If the charge lies in the interior of a conductor, the electric field of the charge does work to the nearby charges. That leads to work done without any input of energy which clearly violates the law of conservation of energy. So, the most favorable situation for the charges in a conductor is to lie in the outer surface.
Furthermore, the electric field lines must be perpendicular to the surface at each point on the surface. If the electric field has any component parallel to the conductor's surface, it again violates the law of conservation of energy; the electric field would do work.
How Faraday cage saves you from lightening?
The metal case shown in figure below acts like a cage where the very high voltage electric discharge is struck and that discharge does not enter the cage. This kind of case is called Faraday cage. Since the charges accumulate on one surface, the opposite charges are induced on the opposite surface, thereby resulting the opposite electric field which nearly reduces the electric field inside the cage and the lighting can not damage the interior of the cage. The Gauss's law for electric fields enforces that there should not be any electric field inside the cage.
The situation is similar for a car. If the lightning hits the car, the opposite electric field induced within the car nearly reduces the electric field due to the lightning and very little or no damage takes place inside. There are several examples of Faraday cages in use, such as your own car to airplanes to microwave ovens etc.
The Faraday cages are not only used for lightning safety, but also used to get rid of disturbing EM waves. However, these cages are can not fully insulate the EM waves. The Faraday cage can not shield the static or slowly varying magnetic fields such as Earth's magnetic field. The compass needle still works inside the cage. The electromagnetic shielding can be made more powerful by using thicker cage with holes smaller than the wavelength of the wave.
When we need the most accurate measurements, we surround the measuring apparatus inside a Faraday cage (such as using copper sheet ) to filter the unnecessary nearby electric fields. This process of filtering unnecessary electric fields with the help of Faraday cage is called electrostatic shielding.