If you slow it down, it would be apparent to you too. High-level human players do this kind of thing to, just not this fast. But effectively, it's watching where the attacking unit is facing and it knows when the next attack is coming, so it knows what the viable targets are and can react when it becomes obvious.
(it's also possible the system is receiving information directly from the game engine, but it's definitely possible to figure this out from nothing but the information on screen)
(it's also possible the system is receiving information directly from the game engine, but it's definitely possible to figure this out from nothing but the information on screen)