What's the physics behind XKCD #2027 (time between lightning flash and radio wave burst)?
I think it's fair to say that explainxkcd.com is the authoritative source for questions regarding xkcd. In this case, a detailed discussion (including formulas) is taking place on the page for xkcd 2027.
Here's a quote from its current text:
According to Wikipedia and other sources, refractive index of air at 0°C is about 1.000277, which equates to a speed of light around 299709.4 km/s (186230.8 miles/s). According to this paper, refractive index for radio waves in similar conditions is 1.000315, which equates to a speed around 299698.1 km/s (186223.7 miles/s). This means that to get the distance, the time difference in seconds between visible flash and radio burst should be multiplied by about 4.9 billion for miles, or about 7.9 billion for kilometers. More details for the calculations are in the comments below.
As for why radio waves are slower in air than visible light - I don't know, and I didn't find any useful sources, but I guess it's because even in the troposphere some molecules are ionized, and the free electrons affect radio waves much more than waves of higher frequencies. What I read about the ionosphere and dispersion due to free electrons in the interstellar medium seems to support that idea. But it's just a guess - I may be completely wrong.
Well, without researching this at all, I’m going to go out on a limb and say it’s due to the difference in refractive indexes between visible light and radio waves in air. Air has dispersion like everything else, and so electromagnetic waves of different frequencies travel at different speeds through it. If you know the difference in refractive index, you can compute the time delay per mile.
Note that the explanation from explainxkcd.com is not entirely correct. Not completely wrong but they make the common error to confuse the group index with the refractive index.
It is the group index that is responsible for the delay of a burst, not the refractive index! *
While in air the group index differs only slightly from the refractive index, in the RF domain, where are many resonant absorption lines due to water, the group index can differ significantly from the refractive index. Also due to absorption lines, the group index is itself strongly frequency dependent in the RF domain.
The actual delay that is observed for a RF wave hence depends on H2O concentration and also on the actual frequency distribution of the wave packet. There is also the influence of the ionosphere.
I found this thesis which does an experimental study of the delay between the lighting and the receive of a frequency burst. Although it is not strictly RF domain, but at lower frequencies, they find different group velocities depending on the environmental conditions (e.g. day vs. night). At least I understand it that way.
*) In fact the refractive index can be below one or even negative without any violation of relativity ("no information can travel faster than the speed of light in vacuum"). The phase propagation (the refractive index refers to phase velocity) is not able to carry any information. Information propagation requires a modulated wave and there the group velocity (and group index) comes into play.
EDIT: Strictly speaking the group velocity is also not always the speed a wave packet travels. This is only true in weakly absorbing media. Since air qualifies as weakly absorbing the group index is in my opinion indeed the right quantity for the problem here, but for completeness I will explain the full story:
Group velocity is the velocity of the envelope of a wave packet. If the absorption is so strong that the shape of the wave packet envelope itself changes during propagation, then group velocity is no longer appropriate to describe the propagation speed. One the other hand it is very difficult to asses the speed of something that changes its shape during propagation. That is why there are other definitions of velocity. Depending on the criteria one uses there is e.g. Front velocity or velocity of energy transport. The velocity that can never exceed the speed of light in vaccuum is the Front velocity. However this is also a bit difficult to work with, both experimentally and theoretically.
As references to the topic one has the book by Brillouin and Sommerfeld "Wave Propagation and Group Velocity" (1960) and the article "The Velocities of Light" by R. Smith (1970) (Thanks to David for pointing this out).