I understand the purpose of the drummers and other musicians in early armies, but I've seen a few movies where they seem to lead regiments and they are the first to get mowed down. That seems like a raw deal to have to go in first armed with only a drum stick, did this really happen or were they in a relatively safe position in battle?
In the Napoleonic Wars drummers marched with officers for the obvious convenience this offered. Their role was to communicate orders over the din of battle so they needed to be there in order to receive them in the first place.
Officers lead from the front but would not lead a charge due to the obvious dangers not only to himself but to the cohesion of the unit. Hence drummers would definitely be in danger, but less danger than an actual front-line soldier. In the event of a cavalry attack the drummer would be with the staff in the centre of the square which was the safest place to be.
In the American Civil War drummers, fifers, and buglers all played an important role in communication during battles and on the march. Some musicians, mostly drummers, were young boys. Almost all were non-combatants, though a few took up muskets or had pistols, but did so voluntarily. Most commanders, company captains in particular, were fathers and decent men and did not force boys into battle. I say most because certainly there were exceptions like in all walks of life. The army 'marching to battle' is a peculiar term, though southern armies could engage while in column. This meant they would be able to move into a line position from a column of four abreast while firing at the same time. But they learned how disastrous this was at the Battle of Fort Donelson. Usually when encountering an enemy unit, companies and battalions formed skirmishes and battle lines. In a battle line there were reserve units in the rear to replace soldiers wounded or killed in battle, along with the surgeons and chaplains. Musicians were regulated to runners and stretcher bears while senior officers called out commands from horseback to their buglers and rode to the various commanders. Some musicians, of course, were wounded or killed as runners or stretcher bearers, but never where they ordered stand in front of the regiments engaged in a battle line on purpose. Movies, of course, are not always accurate. I am familiar with the tactics of the American Civil War, so I cannot vouch for the Napoleonic Armies and other wars.
In the 18th century drummers were often adults, not young boys as has been portrayed. They would be part of the regiment for their entire career and often it would be a family job--their fathers would have been drummers and their sons would be drummers.
Drummers in the 18th century were used to discipline soldiers and were required to flog the men when such punishment was handed out, something a young boy would not be capable of doing. In fact, one source of tension in Boston was the fact that the drummers for the 29th Regiment of foot were black, and they were flogging white soldiers in the public square.
White Bostonians didn't like the idea of black men punishing white men, because they were afraid that it would give their slaves ideas. This wasn't a major source of contention, but it was one of the sources of contention.
Drummers would be stationed near officers, as they were required to communicate officer's orders.
they seem to lead regiments and they are the first to get mowed down.
When technology progressed so far that this became a factor, the practice started to die out. The drummers also simply would stand behind their troops during battle. Nobody marches into enemy fire in marching order.