Is cavalry best used to attack archers or flank infantry?
Charging archers and infantry causes both units to flee, but which results in less loss?
The archers seem like juicy targets, and nearby archers will stop firing to reposition away from the fast cavalry. Sometimes my cavalry takes excessive damage from surrounding archers who all target my cavalry. If I leave them engaged for too long they take heavy losses and flee.
On the other hand you can have infantry break faster, but the enemy archers would be free to fire on you.
Both
Most logical army compositions will consist of more than one cavalry - there is no need to charge your entire cavalry into a single combat zone. Use light/shock against archers: light since they can quickly reach the archers, reducing the amount of volleys you have to suffer before forcing them into melee; or shock, which can kill/route weak archers very quickly. Heavy can either break their infantry ranks (leaving them easier to kill) or flank them to break their morale.
If they have more archer units than you do cavalry, you can charge your cavalry through one archer group into the other, resulting in both being engaged in melee and unable to shoot until they are repositioned. Most archers have very loose ranks which shock cavalry can easily charge through into the next unit.
Or Go for Archers
In the case where you only have a single unit or too few to charge both I suggest going for archers, since too few cavalry charging into the flank of infantry will not do enough damage/shock to break the enemy. However even a very small amount of cavalry can route high tier archers, which will also damage the morale of the enemy troops overall.
Unless they can run
But there is one exception which is your enemy fielding cavalry archers instead of foot archers. However light/strong your calvary is, the chase required to cut down their archers will buy their line too much time. In that case it will be better to just endure a few arrows and crush their ranks, forcing them to route. Even so, use your infantry to lure their archers to fire into your line instead of your calvary, so that after their line routes you'd still have cavalry to chase down their archers.
Whatever causes you more trouble, although charging archers is safer.
The best use for cavalry is to charge either from side or the rear at the vulnerable unit. But the "charge" is the key here - after the charge as cavalry you get a big damage bonus (equal to charge bonus) lasting for (I believe - please someone correct me) about 30 seconds.
To maximize it, you have to keep breaking the contact and commencing the charge again - and here lies the problem: infantry units might not let you break the combat easily and kept chasing retreating cavalry, which of course you can counter by escaping further away (so you'll have time to regroup and charge again), but that requires more micromanagement and puts more "downtime" on your cavalry usage.
In case of archers the risk is smaller, because they are much weaker in melee, so it is quite probable that they will rout shortly after charge.
This question depend on what enemy have best, archers or infantry. If you are fighting versus elves, you wanna pick faster archers before they destroy you with that so many range. On the other hand, if you are fighting versus dwarfs, is better to charge their infantry before they charge you.
For my experience, I prefer to charge archers quickly from behind, shattered them and then charge infantry from behind while they are moving to you.