Specifically, what determined whether a soldier was in the front row or the back row in formations such as these? Did they draw straws before the battle? Was it a rotating position that changed from battle to battle? Was it based on seniority of some sort? I would imagine that the casualties were higher for those soldiers standing in the front row and therefore the back row was a more prized position.
Well after some source searching it would appear that they would simply fall in one after another on their officer or on the position they are ordered to. Starting filling in the ranks and files from left to right (or vice versa, depending on the officer). There was not any official system of allocating who goes where in the rank and file during or between battles and it appears to simply be on whoever happens to be there. This is not a particularly satisfactory answer in regards to your question however, so lets explore this a little further.
Now, as you correctly state, the front rank is likely to suffer heavier casualties than the 2nd or 3rd rank. However this does not seem to be an issue in regards to forming up. Having looked at drill manuals from the period on the training of recruits to fall in there is not one mention of the issue of men squabbling over their position in the rank or how to deal with it.
Now with the apparent absence of this as an issue lets look at why this might be the case. Starting with statistical reasons.
The majority of casualties in Napoleonic battles were caused by artillery. Not enemy small arms fire. The point being that regardless of what rank you are in and how many men there are in front of you it's not going to stop that cannonball. So it isn't going to affect your chances of survival in that regard.
In the specific image you posted an important point of note is that the front rank is kneeling, so in terms of frontage one half of the formation is front rank whilst the other is the 2nd rank. Now obviously this isn't going to affect you all the time but in that case it's going to make very little difference.
Just because you fall in the 2nd or 3rd rank doesn't mean you're going to be there when the guns start firing. Wheeling and changing facings mean that you could go from being in the rear to being in the front in one swift order. So there's probably not too much point trying to get into that rear rank to start with.
Then there's the matter of how much safer the 2nd rank is and for how long. Ultimately a musket ball could still strike you in the 2nd or 3rd ranks regardless of how much you cower behind the man in front of you. However this is approaching the 2nd aspect that needs to be discussed.
How did the men themselves feel about it and why? Well as we've already established it doesn't seem to be an issue so why did they not care enough to try and sneak into the rearward ranks.
Well firstly they are soldiers. In the case of the Brits they're all volunteers. They're not there to die but they are there to fight and they're not going to shy away from it.
Secondly, there's the belief that it's not actually that much better. You're still getting shot at and just because there's someone in front of you doesn't mean your magically immune to bullets. Captain John Kincaid of the 95th believed that it didn't matter whether you went in first or you went in last you were still just as likely to be shot. (He was referring to the forlorn hope during siege assaults but it does reflect the attitude in general.)
Finally there's the sheer tenacity and bravado of the men. They're not going to whine about being in the front rank nor get punished for attempting to be cowardly. Now this doesn't apply to everyone of course but take a look at the forlorn hope during a siege. It was composed of volunteers, the most dangerous and bloody job in the entire military of the period and it was done only by volunteers, they rarely ever had a shortage of them and frequently had too many. (I recently did a post on this, I can link it on request.) To ask why they felt as they did is impossible to know without asking them in person.
To conclude, it's not necessarily any safer by any large margin and the difference between going into battle and going into battle with a man in front of you is not so great as to cause disputes about who goes where.
Sources
A Treatise on the British Drill and Exercise of the Company
Rules and regulations for the formations, field-exercise, and movements, of his majesty's forces
Die Hard, Dramatic Actions of the Napoleonic Wars - Philip J Haythornthwaite
British Napoleonic Infantry Tactics 1792-1815 - Philip J Haythornthwaite