I think it helps to realise that the engine does not make assumptions for mistakes during its calculation, instead it only considers best-play by both sides for as far as it can see (depth, time, etc). This would be the only objective way of going about it, and that's how it assigns its principal variation.
In general positions, the normal working of the engine is to continuously go through ever more lines to higher depth, and adapt accordingly its evaluation of the main variations. But, when it comes to there being mating sequences among the principal variation candidates, the key difference stems from the fact that all mating variations are by definition forcing sequences, i.e., the engine gives such variations a "mate in X" evaluation only after having exhausted the full set of possible replies (more technically, within the allowed depth, it has managed to reach the endpoints of all those branches, and they have ended in checkmates). Thus by construction, it cannot have mis-evaluated there being at least "a mate in X" when in fact there's only a mate in "X+Y>X." And as for cases where it keeps finding shorter mates, that's because it is still performing truncations in its exploration of the tree, so even though it may have already found one branch with a forcing mate-sequence (thus at least one winning move), the other unexplored branches (other potential winning moves) may have led to more efficient mates, given more analysis time it will eventually check them and realise a shorter mate.