In some cases the two sides are so evenly matched that neither can decisively defeat the other.
In other cases of never-ending wars, the two sides were clearly asymmetrical. One side easily could and should have won decisively and ended the conflict with a lasting resolution. Yet the apparently stronger side chose not to win, or for a variety of circumstances was prevented from victory.And often the stronger side is aided in making this decision by the weaker side which chooses to never pose an extential threat requiring it to win.
The American slog in Afghanistan is somewhat similar. Americans feel that the level of force and violence necessary to obliterate the Taliban and impose a lasting settlement is either too costly, or not worth any envisioned victory, or impossible in such absurd tribal landscapes, or would be deemed immoral and contrary to Western values. Therefore, as in most serial wars, the U.S. chooses to fight to prevent defeat rather than to achieve lasting victory.
The bizarre modern Western doctrine of “proportionality” (akin to the tit-for-tat blood feuds of the Icelandic sagas) tends to ensure stalemate. Leisured Western publics are uncomfortable with using their militaries’ full strength, given the collective guilt and bad publicity that accrue when their forces inflict far more losses than they have incurred.
Paradoxically, disproportionality was always central to resolving chronic wars: Having much more power makes the weaker aggressor suffer so much that it never again tries to undertake another attack.