(X = melee, O= Xbow, Z = spears... cavalry presumed to be roaming wherever it is most useful)
_____X___ X
X Z X O O O X Z X
_____Z___ Z
Xbows are in the middle of the line with clear field of fire, they can take the sting from the enemy's heaviest units before they reach the line - and when they do arrive, the AI can't resist sending his men after the Xbows... they are looking un-protected to him... just as they are nearly engaging my Xbowmen the Xbows pull-back and the spears behind them take their place in the line; meanwhile, my fore-most melee units (on either side of the gap) 'close the bag' and charge enemy units (which 9 out of 10 times will swerve around any other units to get at my Xbows if they're close enough) from the rear and flanks.
Hopefully by now I've engaged or routed all the enemy melee-units and cavalry, and can re-position Xbows on the flank to fire into the rear of the melee (or enemy missiles)... not fool-proof, but in a tough battle (when enemy has a good general and takes an age to rout) my Xbows can account for 20-40% of all kills, while only being about 10-15% of my total force.
Can't argue with their usefulness when they often out-score my H. Cav (in kills, obviously).
And if my melee units are fighting a losing battle, I have no qualms about letting-rip with a few massed-volleys right into the middle of the fracas... ironically, it is only 'smart' to do when you have a chivalrous general - your spear militia or peasants will fight to the last man, and will often still be standing (maybe just 1 or 2) when the enemy's superior armoured units flee under a hail of Xbow bolts (or artillery-bombs
) - evil... yes, and also desperate, but it doesn't make you more dreadful
.