It's an odd one, it's not exactly 'random', but there does appear to be a 'good or bad' engine factor, eg a 'good' engine you can overrev massively and it just keeps on going, and a bad engine can pop the first time you overrev.
I could be mistaken but that's how it appears, I've done skippy races before where I've been overreving massively into a corner on every lap of the race and it's fine, and then others were I mistime the downshift (too early) and pop the engine instantly.
The last one is really quite rare though, as in once or twice in god knows how many races...