How does lightning and thunder form?
It is not absolutely clear how lightning is formed, but where it comes from is pretty well known.
Basically, what happens is that when storm clouds form, they are made up of lots of dust and vapor particles. Through some mechanism, this cloud becomes electrically polarized or charged (this is the part scientists are unsure of how it happens. Theres lots of debate as to what method causes it to happen, but the results that follow are pretty well understood).
Due to the fact that a lot of electric polarization/charge can be accumulated on a large cloud, the air below starts to ionize (become charged/polarized, just like the cloud) and does so very quickly. Since ionization in one region of air can cause another region of air to become ionized, this can happen between clouds, or between the clouds and the ground.
These channels of ionized air are much more conductive than regular air, so electrons move much more easily thru these channels than regular air. These ionized air channels look much like the "electric sparks" you see due to static electricity by rubbing your feet on the ground and then touching something. Really what you are seeing is air getting ionized, and it giving off light in the process. These sections of ionized air are much bigger (about 160 feet long) but you pretty much can't see these unless you're very close.
If there is a series of these channels of ionized air that hit the ground, the ground is very conductive compared to air, and will give up a large amount of electric charge into this completed circuit (between the ground and the cloud) that causes a lot of charge to flow from the ground upwards to the cloud (this is called the return stroke and is basically what you see as lightning). This ionizes the air completely between the ground and the cloud, and this is the part you can see for miles around.
oftentimes, there are things called "restrikes" where due to this ionized channel there is an excess of charge between the cloud and ground still, so charge travels in that channel of ionized air a couple of times. This causes the flashing-light effect of lightning that you can see (where you see it flash several times).
As for thunder, since the air ionizes very quickly over a large region, it causes a lot of air to move. If you want, you can think of it as an explosion, or a sonic boom (the physics of the sound is the same). Which direction the air moves is still under debate, but basically it's due to motion that breaks the sound barrier that causes the thunder.
There are lots of other phenomena involved in lightning strikes that we don't understand, but this part we understand relatively well. Since lightning happens so quickly, it is difficult to study. And due to the fact that the system is non-linear (very difficult to calculate / simulate) the theory is not very well developed.
Electrical charges get separated in thunderclouds as a function of height. Nobody knows exactly how this happens, although it is thought that it has something to do with the contact between water droplets low in the clouds and ice crystals higher up. In any case,parts of the cloud develop an excess of electrons, thus a negative electric charge, and others develop a dearth of electrons, thus a positive electric charge. This separation of electric charges generates an electrical field.
All substances, including air, resist the flow of electrons, but if you overpower the resistance, the air will spark: a channel in the air will ionize, becoming a plasma, in which the electrons are free of the atoms they had belonged to. Electrical current flows very easily in a plasma, so the charges run down and the process starts over again. Plasmas, however, require a great deal of energy to form - the plasma that forms from a spark is about twice the temperature of the sun. Being twice the temperature, it shines about sixteen times as brightly, which causes it to rapidly cool off and become gas (air) again once the current has flowed, which is almost instantaneous, because plasma is so good an electrical conductor. Also being so hot, the plasma explodes into the surrounding air, creating a shockwave.
The flash from the hot plasma is what we know of as lightning, and the shockwave, thunder.