Basically the method they evolved copes well with losing the queen. Out of various ways of dealing with having a dominant Queen some may lead to replacement if she dies.

There are lots of examples of method is very effective at creating lots of successful offspring but happens to be less than ideal in some situations. Natural selection is pretty amazing and awesome at creating effective genes but we certainly can look at the results sometimes and see improvements that would be useful.

Likely if losing the queen was very common a good way of dealing with that would be found (or that species would be disadvantaged and at risk). If the queen happens to evolve to being very reliable coping with her death becomes less important. If they produce lots of useful offspring but have a less than ideal method of coping with their home colony losing her it is entirely sensible to imagine that species could flourish.

I would imagine species with queens that had shorter lifespans, that invested more in the home colony, that were less effective at setting up new colonies… would be more likely to have better queen replacement strategies/results.