When it's the AI's turn, it analyzes which unit it can attack within its single turn – then it evaluates which of them is an archer (1), a flying unit (2), or an infantry unit (3).
If it can't reach any of our units within one turn, it then evaluates which unit it can reach within two of its turns... and the cycle repeats.
My favorite tactic is to eliminate a lot of elementals on the first day on impossible difficulty using starting troops – sacrificing one gargoyle at a time to prevent neutrals from reaching my centaurs.
The neutrals will initially run towards the unit they can reach – that is, the gargoyles – and only then will they evaluate our centaurs as opponents.
It's especially fun on the second round to lure neutrals back to their starting positions using gargoyles. :)
The same applies to the three heroes.