Well. Since the targets are moving, and the time between the clicking command and when the actual projectile hits is to different that the target could of moved and the closest target is now another man.
So I guess they do it like this...
A soldier has a circle around him that determines the range of every enemy. So inside of this circle can he reach with his weapon and will fire on the one who enters it
like this... But in this case. The targeting options is only one. So it isn't such a hard way to figure out who he would fire at.
But. If it looks like it does in this scenario, it will be a bit more difficulties.
but what he does here is to messure out who is the closest target when he begins to fire. But. Sadly enough, both the red dot and the green dot is on the same distance. Well then he haves to choose. Then the easiest way to solve this is do just choose on randomly. But because that would look like the bot had 5 IQ, is there a smarter way to figure it out. The AI adds the 5 yards that the green dots distance is with the red dots 5 yard distance. Which gives the AI 10 yards. Now the AI is searching for a target that in the 10 yard distance and is in sight of the AI. So that will result in that if three men is charging against a armed man, will the armed man fire against the most obvious target. Instead of turning around and finding a new target. And if it doesn't find that. It will randomize a target to fire at.
Allthough. I am not sure if this is the way Mount & Blade do it. But it is the most commun, and most cunning way to do it.. So far..