When does one light the ner shamesh – before saying the brocha or after one has lit the ner Chanukah
The official purpose of the shamash (based on the Rema) is to serve the other candles.
In this case (where it serves to light the other candles) it is lit first.
Even if it is not used for lighting the other candles, it serves them in producing a source of light other than the candles. This is important, because it is forbidden to derive benefit from the light of the Chanukah candles, and the additional source of light permits one to derive benefit.
Yet, in this case, the Tur writes that the “last candle” is the extra “shamash” candles. It is lit last, and separately from the other candles.
Some light the shamash before reciting the berachos for the Chanukah candles.
See Orach Chaim 673:1; see also comments below.