Why do nitro groups confer explosive tendencies?
Explosives chemistry is a rather complex topic. I've heard that this book is a good source of information about it (I haven't read it).

In a nutshell, your intuition about the nitro group is accurate. Formation of $\ce{N2}$ is highly energetically favourable. To get an explosive, what we need is a rapid reaction that produces a lot of heat and gas to both cause the obvious effects of an explosion and to propagate the reaction to other molecules of explosive. The rapid part is what separates something like TNT from toluene. The combustion of toluene is also energetically favourable, but in TNT, to create $\ce{N2}$ is not dependant on mass transport of any other species and can thus happen very rapidly, whereas the combustion of toluene is limited by how quickly oxygen is transported to it. If one were to vaporize toluene in the correct concentration in air, this transport problem goes away and an explosion can occur. TNT also has an advantage in this regard because the nitro groups provide a source of oxygen to react with the carbon and nitrogen remaining (not enough for all of it, but it helps). Explosives are often mixed with fuels or oxidizing agents to produce a more oxygen-balanced mixture for a more efficient explosion.

As for what happens first in an explosion, many different reactions can occur during an explosion, but it may be helpful to consider what it takes to actually detonate TNT and think about the timescale of the reactions. TNT is a solid at room temperature and has a flash point of 163 °C making it difficult to even ignite, and while it will burn in a fire, there is no risk of explosion. For an explosion to occur, enough gas and heat has to be produced to propagate the reaction through the bulk of the material. In practice this is done using a much more sensitive explosive (other explosives like lead azide or nitroglycerine are unstable enough to be set off by heat or pressure) to produce a small shockwave that provides the activation energy to initiate a reaction as it travels through the explosive which then sustains the shockwave through the rest of the material. In a normal explosive (not a fuel-air explosive or the like), the reactions that contribute to the bulk of the explosion are limited to what the explosive is made of because the speed of the explosion is too fast for air to play much of a role initially. 

In the case of TNT, the experimentally-measured time it takes for a shockwave to pass through is 100–200 fs (no idea how one measures that), so any oxidation of the carbons seem unlikely to contribute much to the the initial explosion, given the only readily available source of oxygen is from the nitro groups which must presumably decompose first. This group proposed a few decomposition pathways for TNT, including homolytic cleavage of the $\ce{C-NO2}$ bond, rearrangement from $\ce{C-NO2}$ to $\ce{C-ONO}$ followed by homolytic $\ce{O-NO}$ cleavage, and $\ce{C-H}$ attack from an adjacent nitro group to the methyl ring substituent, but they found that only the first was fast enough to occur during detonation, the others possible only for lower temperature thermal decomposition. This initial decomposition step is the only thing fast enough to contribute to the shockwave that sets off the rest of the TNT, while the reactions that produce the final products occur (relatively) long after the initial blast has initiated the rest of the explosive.