AI goes for casters, bcs they usualy have lowest AC ... and therefore they have simply bigest change to sucess their attack.
Its just as people say: "kick where it hurts mostly" simple as that.
Its quite logical when you think about it, what sentient or at least semi-sentient creature would attack plated dude with tower shield ... when next to him is another dude in cloth robe?
Agreed that there should be another targeting mechanism for beasts, wich should simply attack closest enemy, bcs they usualy cant understand defences of their enemies ... but that is different topic.
And for you second question ... why they keep attacking downed character?
Well, either once aggain, lowest AC ... therefore bigest change to hit ... therefore most effective strike.
Or, bcs if they would ignore them, your party will be litteraly unstoppable.