Engines lose because they aren't perfect. Not all developers do this, but for example they can change how it evaluates a few things, then have it play a few thousand test games. If it scores 1% better than the last batch of test games, then they save the changes... even if that means in some positions now it's playing worse than before.
---
Anyway, there's a pretty big drawing margin in chess when it's played at a high level... for an easy example in many endgames being a pawn up isn't enough to win. So an engine may be better, but like all strong players (whether they be human or computer) most of their games with peers are draws.
I'm wondering if the top chess engine in the world ever loses to other engines? If so why?
I'm just assuming that if the top engine is even slightly better than the second best engine it should still be able to win consistently. If this assumption is wrong what variables would make a higher ranked engine lose to a lower ranked one.