Alas, I fear your question is incredibly broad, as not only each nation trained their officers differently, but this varied between the navies and armies of each nation.
It's interesting that you pick 1800 as your year of reference - this period was right around the transition of many nations' movements to having a fully professional military.
1802 saw the creation of the Royal Military College in Britain; Saint-Cyr in France; and West Point in the US. Each of these establishments sought to induct young men and train them to be officers (although, selection criteria were different in each nation).
Britain also had created a college for staff officers in 1799, taking junior officers and imparting knowledge such as trigonometry, geometry, French language, and siege warfare.
As for navies - in Britain sons of the well-to-do would join the navy at the age of ten or even younger, as a servant to a ship's Captain. Eventually, they would learn the skills of being a naval officer by direct experience from the senior crew of the ship, and gain a commission.
In particular, Imperial France and Britain led the way to professional militaries through the Napoleonic Wars - a period where ability trumped good breeding (though not always trumping money). However, during Britain's relative peace, the officer class became full of paid commissions again - the practice wasn't stopped until after the Crimean War. Training of officers took a while to improve, but made huge leaps around the World Wars.