Let's say I am in a battle with four trolls, and I have the highest initiative, so I attack first. Should I randomly choose a troll to attack? Proximity to each troll does not matter (it is not a factor in the algorithm). I remember playing an older RPG (I think one of the Final Fantasy games on N64), and the attacks appeared random. You might have one troll that never gets hit, or you might have one that always gets hit. Is there an acceptable standard?
You could solve an equation to see which strategy is the best.
There are 4 trolls and they all are different. Each one does N damage per second and takes T time to kill. In said example you have 24 possible killing sequences (1-2-3-4, 1-2-4-3, 1-3-4-2, etc..) you can estimate/compute all of them in under 1ms and choose/suggest the best strategy for the player.
Of course it would be nice if player could choose any one he likes to be killed first instead :)
From a realistic-y type PoV:
The heroes aren't really going to know 'oh look, this troll is the most damaged' or 'this one is the largest threat' too much. Mostly since they'll be avoiding getting hit. They're going to attack whatever is closest to them. As such, I would say in the situation like this (H for Hero, E for Enemy)
H1 will go for E2, H2 for E3, H3 for E4.
The other option is totally random, or let the player choose. It's probably easiest to let the player choose to avoid 'whoops, accidentally didn't kill the boss who had 3hp left oh look I am dead'.
There are a bunch of different ways to solve this problem, as others have said. This ranges from a completely random choice to completely player chosen.
One game that has the style of semi-randomness that you were talking about was Ogre Battle 64. All attacks were done without player choice, but you could direct how you wanted your squad to act. The options were autonomous (pretty much completely random), target weakest (try to kill the enemy with the weakest health), target strongest (slowly weaken the opposing squad), or target leader (without a leader, the squad tries to run back to their base).
The kind of system you want depends on the kind of game you are making. The typical Final Fantasy game is not based around large scale strategy, but are more based on the individual tactics of a single fight; allowing for almost complete player choice tends to be the best bet for this style. In a squad based game, like Ogre Battle, you may want to make the player focus more on the strategy, such as where the squads are placed on the map, or which enemies to kill or weaken first.
Depends on how smart you want the decision to be, which is a gameplay design decision - do i want a fluid gameplay where your AI party members automatically pick the correct things to hit on the head so that the player can just do his thing and keep hacking and slashing without being interrupted, or do i want "dumb" party members so that the player has to use his head and make all strategical decisions (maybe even after pausing the game)?
In Dragon Age (might have been done before so don't kill me) for example they've let the player pre-script the behavior of his party members and tell them how to "automatically" make that decision (and others as well).
About the AI picking which one to start striking first - are they all identical and distance doesn't matter? In that case i don't see why not pick a random one. Otherwise some things to take into consideration are which one would be the fastest to kill (least armored, smallest health buffer, already damaged)? Which one deals the most damage? Which one has an ability to heal it's allies? Which one has misc abilities that might be a threat - such as temporary disabling your friendly characters and debuffing them. Based on those and other factors you should make some sort of a score system, you check which troll gets the highest score, and this one gets attacked first.