I googled Gilbert du Motier, Marquis de Lafayette after learning of his existence through the Hamilton musical and noticed in his Wikipedia article that he was commissioned an officer at age 14 with the rank of sous-lieutenant. The article clarifies that his duties were largely ceremonial but I'm curious if this was always the case.
So was this normal? I found this previous answer which is fantastic but applies primarily to the navy.
How did this work in practice? Were lower-ranked soldiers expected to follow the orders of their teenaged superiors?
What was the purpose of commissioning such a young officer?
I would not say it was the most common practice but it was a normal thing to occur. In the 18th century with the military becoming a profession as the decades rolled on, one would see more youth enter the services. I have talked about how commission ranks worked before. For a refresh: For most armies, ensign is the lowest of the commissioned officer ranks along with cornet for the cavalry. Both come from their role as a standard bearer in some manner as ensign literally comes from 'flag.' The cornet is of course a horn instrument. They were used to rally soldiers or troops to a point in battle. By the middle of the century, that duty often went away for some armies. The Austrians abolished those ranks in 1759, replacing it with second lieutenant equivalents. Lafayette got his entry with the same rank, sous-lieutenant.
How could he get a commission at a such a young age when in that time you had to actually buy your rank? Family. The majority of French army officers came from the nobility class, which is where Lafayette originated. The need for nobility in officer roles came from the social distinction of upper class versus the common class. If one is thought to be better socially, then one needs to remain so in the military. Rare did officers come from the lower ranks and usually in the form of "soldiers of fortune" gaining battlefield commissions and favor from higher ranking officers. Some came from the newly forming middle class that gained their wealth from business, merchanting, or some other respectable trade. Both John Andre and Banastre Tarleton come to mind in that regard. The young men of 14 to about 18 that acquired the commissioned rank of ensign or second lieutenant had their family pay for it. The cost would be paid for upfront but that still only covered the rank - not the uniform, camp equipage, horse, and accoutrements. Often times parents would have to send more money as the new ensign or 2nd lieutenant found out his meager officer pay barely covered the overly lavish officer life on campaign.
The reason some started out this young is either because they had family in the military and it would be to their advantage to start out this young for better chances of promotions later, or the family needed the younger sons to find a profession for a livelihood. On the latter, the eldest son would of course inherit the family estate, the younger ones would then have to find other means of financial income. For upper classes, they had few options for respectable occupations to choose from. Doctors, lawyers, church, and by the middle of the 18th century - the military became options for the younger sons. It was a way to get rid of the kids so to speak, and should the military career become promising it would bring honor to the family.
As I mentioned, the ensign, cornet, or second lieutenant had some small roles in the army. The flag bearing role went away for most armies by the middle of the century, but that did not mean they had command on the field. There is a common thought that I have heard from others that state: "Ensigns are the useless officers on field who just carry a sword and look fancy." I have read it in a Sharp novel and I have heard it from amateur living historians. It is a bit of undeserved criticism towards the rank since it is one of no experience and different roles within the company. Command of the company would be from the captain, the captain-lieutenant in some cases, or a lieutenant in the rare case of a captain's absence or casualty.
From General Wolfe's Instructions to Young Officers in 1768, ensigns should:
inspect the quarters of those men who are billeted upon the houses of the lowest class, as they are most likely to be prevailed upon, by the disobedient soldier, to give him liquor for his meat...they are to attend the looks of the men, and if they are thinner or paler than usual, the reasons of their falling off may be enquired into, and proper means to restore them to their former vigour.
Ensigns might also have the position of adjutant or quartermaster and keep lists of the company inventory and the need of supply. He also might give role call, attend drills on the parade grounds, and be part of the guard. The science behind these roles is for the ensign or junior officer to get acquainted with military life and the people of the company. Once he gets to the rank of 1st lieutenant, he will have the necessary experience to be efficient in military economy and be seasoned enough for bigger duties. A bit of respect from the soldiers does not hurt either.
Speaking of respect from the soldiers. To your question of lower ranking soldiers taking orders from teenage officers, the answer is yes. While the average soldier in the 18th century had an age of around 25, and some in their 30s, they still had to take orders from the young officers. The rank of ensign still holds power and authority over the common ranks. Older officers would take them under their wings and non-commissioned officers would be their crutch until they learned the ropes enough to do it on their own. While they did not have authority in battle they still had command over their in work parties, sentries, drills, and garrison duties. Any form of disobedience, insult, or other means of disrespect towards the young officer from a lower rank is the same as doing it to an older officer. The soldier would be punished, often after court martial, for disrespecting the officer which is a serious offense in the army and often lead up to 400 lashes. The soldier must respect the gold or silver lace, no matter the age.