If the monster has a multi-target attack, it will move toward a position where its attack will hit its focused enemy and as many other enemies as possible.
As long as the enemy can reach that spot with its current movement, it will try to maximize the targets it can hit even if takes more moves to get there.
When forced to choose, a monster will prioritize losing Disadvantage on its focused enemy over maximizing its attack on secondary targets.
This archer would move 1 space away before doing a ranged attack.