I would like to begin this post with a map that displays the growth of Brandenburg-Prussia up until 1795. (See below)
In 1740, King Frederick II (Frederick the Great) came to the throne and was largely responsible for the partitioning of Poland between Russia, Prussia and Austria in an attempt to limit the growth of the Russian Empire and stabilize the balance of power for the region. Fredrick William II ascended the throne after Frederick II's death and continued the partitions, gaining the greater part of Poland to the West in 1793. In 1795, the Kingdom of Poland was officially disbanded and its territories were divided up into three new Provinces: New Silesia, South Prussia and New East Prussia.
The Napoleanic Wars (1803-1815) involving Napoleon's establishment of the French Empire and a shifting of European allies and opposing coalitions, were the cause of major change for Prussia and indeed for the rest of Europe. By 1811, Napoleon had managed to conquer nearly all of Europe, as seen in the map below. (The dark green areas show Napoleon's Empire and the light green areas, its territories. The blue, pink and yellow areas indicate French satellite states.)
In August 1806, Friedrich Wilhelm III made the decision to go to war independently of any other great power, save the distant Russia, with whom Prussia was allied but its troops too far away to be of help. This marked a major turning point for Prussia, leading to its near defeat by October, forcing the king and his family to flee temporarily to KlaipÄ—da in today's Lithuania (at that time East Prussia), which possessed one of the strongest fortresses in all of Prussia and thus becoming Prussia's temporary capital. Even worse, Prussia lost about half of its territories, including the three partitioned provinces of Poland gained in 1793 and 1795, which in turn became the Duchy of Warsaw under Napoleon. Beyond that, the king was obliged to make an alliance with France and unwillingly join the Continental System.
Napoleon attempted to invade Russia in 1812 which ultimately lead to his retreat from Moscow and Prussia's breaking their “obliged” allegiance with France. In 1815, a final coalition including the United Kingdom, Russia, Prussia, Sweden, Austria, the Netherlands and a number of German states formed to pit one last war effort to stop France's megalomania.
The Prussian army was extremely crucial in the final victory over Napoleon during the infamous Battle of Waterloo in 1815, resulting in the complete recovery of Prussia's lost territories as well as the attainment of the whole of the Rhineland, Westphalia and various other smaller territories, as rewarded during the Congress of Vienna. This resulted in Prussia becoming the dominant power among the Germanic nations and its entering into the German Confederation, replacing the now abolished Holy Roman Empire of the German Nation.
Expansion of Prussia from 1807 – 1871
Kingdom of Prussia at the formation of the German Empire in 1871
With these newly acquired regions, the Kingdom of Prussia dominated northern Germany politically, economically, and in terms of population, which had doubled as a result, and was the core of the unified North German Confederation formed in 1867, which became part of the German Empire.