I'm assuming it was nothing like in the movies where there is a battle going on and archers are firing volleys in to the middle of the fighting. Did the archers only fire when none of their men were in the vicinity of their targets? If so were they more so used as a defensive tool to stop a sieging army?
Edit: If I'm not mistaken, I believe that the english longbowmen were among the most effective so I guess I would like to have my previous questions aimed towards how they operated.
Very broadly speaking, archers were not deployed in a manner where they would be forced to shoot towards their own troops. The visual reference of archers shooting in tight volleys is not only very much ingrained in our minds due to movies, but also not practical in a real context due to limitations in communications as well as the inability for archers to hold onto their shots until they were given the command to loose. Movies also over-emphasise the high-angle volleys, which is mostly done for cinematic effect, but are also due to other practical considerations such as safety, camera angles/tricks, and due to the low power of the bows (or mechanical launchers) requiring them to be lobbed at high angles. In practical battlefield archery, while long-distance volleys were likely to have been used, much of archery was actually done in direct shooting, as this is the role in which archers are most effective due to power, penetration and accuracy.
Since we are specifying English archery in this thread, this becomes easier to discuss as the sources and discussion on English archery in the medieval period is quite well known. However, it should be noted that we should avoid the "longbow bias" - there is a high amount of romanticism concerning the English longbow. The effectiveness of the bow was not unique to the English - and indeed, the English were outliers in many ways, not least of all because of the European powers at this time, they exclusively adopted the bow as an integral part of their army, leading to mandatory ownership and practice with bows through the Assize of Arms 1252 and royal decrees from Edward III (such as banning the sport of football). Nonetheless, we can use the experiences of English archers to understand how archers avoided "friendly fire".
While sources are sometimes ambiguous on how English archers were deployed, which also varied depending on the terrain and nature of the battle, it is generally agreed that in normal circumstances, the English archers (who could number over 5000, in an army of 7000 to 10,000) were deployed in "wings" on the flanks of the main body of dismounted men-at-arms, ideally in a raised position (such as a hill) and fighting defensively. The objective of this deployment was to funnel the enemy into the central body of footmen, given that soldiers were less inclined to march straight thousands of archers shooting at them. The archers would open the battle at long distance (exact distances are vague, but this could be 150m to over 250m), and they became very accurate and more effective when the battle closed to 50m or less, as they were now capable of using direct shooting with heavier armour-piercing arrows, sometimes shooting at cavalry as they were nearly right on top of them. When the enemy closed to engage in melee, the archers stepped back and the footmen advanced to carry the fight, leaving the archers to reposition, continue shooting at targets of opportunity at close distance, or join the melee with their swords and mallets.
Let's look at some specific battles:
Falkirk
The Scots formed schiltrons to defend themselves against English cavalry. The English formed up their archers, slingers and crossbows to barrage the stationary, unprotected formations while their footmen advanced. The English cavalry broke through once the schiltrons began to thin out due to the overwhelming arrow barrage and the Scots were overwhelmed by the footmen. The archers were deployed to shoot directly at the Scots, not over the English lines.
Dupplin Moor
The English army was deployed in a crescent moon formation, with the archers on the sides and the men-at-arms in the centre. The Scots launched a foolish charge straight towards the English, and were met with the fearsome English arrow storm, which devastated their ranks. The ferocity and volume of arrows caused the Scottish army to move towards the centre to take shelter from the arrows, leading to many of them being crushed and trampled by their own, before being pushed into the English line.
Halidon Hill
The English position their archers on top of a hill and shoot down towards the Scottish schiltrons (by now you might have noticed the schiltrons are terrible ways to deal with archers). The Scots, devastated by the archers, are forced to charge uphill, and are cut down by English footmen.
Crecy
One of the most notable engagements involving English archers. The English were deployed into three main forces, each one consistent of a central body of men-at-arms flanked by larger numbers of archers. The English archers outshoot and rout the Genoese crossbowmen on the French side. The French cavalry attacked, but were disrupted by the fleeing Genoese and constant arrow barrage. Forced to fight uphill, the French were unable to break through the English lines.
Poitiers
The French attempt to attack the English archers by dismounting and fighting on foot. The English mounted their archers and rode to the flanks, where they deployed and shot into the French rear.
Agincourt
The battle that the English are generally known for. The English archers deploy behind stakes, entice the French to attack and barrage the French as they attacked across the muddy ground. When the French line clash and push the English men-at-arms to the brink of defeat, the English archers join in hand-to-hand combat and turn the battle.
---
What we can learn from this is that, ideally, archers were deployed in positions where they did not have to move, had clear line of fire on their enemy, were able to shoot directly and without harassment, and were protected by infantry. There was seldom a need to shoot over, toward or at their own line as they were not deployed in that fashion - the infantry line did not advance until the melee was inevitable and the archers withdrew and allowed the infantry to fight. The volume of arrows that the English archer formations were able to output deterred enemies from attacking them directly, causing them to be funnelled towards the infantry, which made archers more effective as they were also able to shoot into the flanks of infantry and cavalry.
Archers were, of course, not invincible. When caught out of position or rushed by cavalry, they could be overwhelmed, such as at Formigny and Patay. This, however, goes beyond the scope of addressing how archers avoiding shooting their own men. For that, it's clear that they weren't shooting arrow storms into the back of their own infantry. The English armies were mostly defensive in their tactics, enticing their opponents to attack them, and thus the English were often able to win battles with smaller armies.
References