You see all these paintings of army's from a few hundred years ago with rows of men with muskets facing each other in battle, so my question is how would they decide who stands in the front? It seems suicidal to be in those positions. Drawing straws? Volunteers? Rank? Thanks for your time!
It depends on what level of formation you're talking about. By the end of the Napoleonic Wars in Europe, most armies had adopted a corps system, in which armies marched and fought divided into several smaller units which all had a combination of infantry, cavalry, and artillery (if you faced an enemy force without one of the three, your were screwed). The frontage of an army in battle would therefore be the frontage of several corps abreast.
A typical corps (organization varied in the Napoleonic period, but bear with me) would have two or three infantry divisions (each about 10,000 men, give or take a few thousand), and the typical division would have two brigades of two regiments each. It was standard for a brigade to fight completely deployed, with every man fighting in its two or three man deep line of battle. Its sister brigade would be formed up behind it, and they would ideally switch places after major actions -carrying an assault, repelling an attack, that kind of thing.
Within a completely deployed brigade, the men in the front rank of their companies would typically not be the first men to take enemy fire. That honor would go to the skirmishers. During the Napoleonic Wars, their organization varied too. Some were part of designated Light regiments (which received the same training as standard Line regiments), others part of dedicated skirmisher companies within their battalions, still others were drawn from the third rank of the infantry line, and often times the entire front line of the corps settled into a think skirmish line.
These men would dispense with lockstep, elbow-to-elbow formation and take cover behind whatever shelter or obstacles the ground provided, and fire at will. Aggressive skirmishing gave the corps's line infantry time and space to deploy into line of battle or columns of attack (a very different formation than the four-across marching column; a six company battalion would form up with three lines of two companies each, so eighty men across).
Believe it or not, within the company, a man's position in the ranks was determined by his height, and in the eighteenth century, by his mustache. The regulations for infantry in the Duchy(?) of Brunswick gave instructions for forming the men up in a line of four ranks.
All the tall men with moustaches are placed in the first rank, with due attention being paid in the dressing to a uniformity of appearance—thus we do not like to place an old soldier next to a much younger one, or someone with a thin, half-starved face next to an individual with a strong countenance. The flanks are most in evidence when the soldiers march past, and so they must be covered by our most handsome men with good faces. Men who have moustaches, but are less good looking, are placed in the second rank, but if there are not enough moustaches to fill the whole rank, they must be positioned on one of the flanks. The shortest men go to the third rank, and the tallest men without moustaches to the fourth.
Winfield Scott's drill manual (largely based on Napoleonic French drill) contained instructions for forming up the infantry company in three ranks. The company would form up in a single, long line, with the tallest on the right and the shortest on the left, and every three men would form a file. To illustrate, imagine a line of numbered men like so
9 8 7 6 5 4 3 2 1
They would form a three deep line of battle like so
7 4 1
8 5 2
9 6 3