Chemistry - Why do s-block elements impart color to a flame?

All elements colour the flame somehow. The salt that is held into the flame dissociates homogenously (i.e. you’re not creating unpaired ions but rather single metal atoms and their counter-radicals), the heat energy excites the electrons and when they fall back down they emit photons at certain wavelengths, corresponding to the energy differences between the orbital an electron was excited to and the one it falls down to.

The further away from the nucleus the electrons are, the easier they are to excite. Thus valence electrons are most likely to be excited. The more valence electrons you have (i.e. the further right you go in a given period) the harder it gets to excite one of them because the whole atom contracts and the energy levels of the outer shells are lowered. Therefore, it is a lot easier for electrons of elements on the left half of the periodic table to be excited.

Furthermore, the more electrons you can excite, the more complicated the resulting spectrum will be. For only one or two electrons, you usually expect (and observe) distinct lines of definite wavelengths; the more you have, the larger the possibility of broader bands.

Therefore, the easiest element to recognise would be hydrogen, which only creates very few single, distinct lines. Alkaline metals, having few valence electrons, will still create easy spectra with distinct lines (albeit more). It is similar for alkaline earth metals, although the spectra tend to get more complicated (see barium for an example of something with broad bands). For many, if not all other metals, the spectra just get too difficult to interpret and consistently assign very quickly. They will all seem white-ish to some degree with hardly any possibility of distinguishing characteristic lines easily. Thus, in the typical inorganic chemistry ion lottery lab course, typically only alkalines and alkaline earths are detected via flame colouring.

I also remember from that course that copper halides seem to provide a more characteristic green colour (that I didn’t even try recognising — I relied on other methods to detect copper). I think that there is a mulitude of combined effects in action to give this combination its characteristic colour. In any case, I don’t know what exactly is going on there.