A couple of reasons
France's true strength under Napoleon was Napoleon himself and his inner circle of marshals. The book Blundering to Glory mentions that he didn't actually have a superior doctrine, or any doctrine at all. He simply improvised his way to victory and used his focus and energy to win, and was an expert at selecting competent subordinates. Napoleon could tell that his future cavalry commander Murat "radiated force" as early in his career as the whiff of grapeshot putting down a small riot in Paris. In Napoleon's words, the most important quality of a general wasn't brains, but "energetic determination". Napoleon actually fought with inferior arms at points and still pulled off wins - for example, in the Battle of Dresden in 1814, Napoleon won an Austerlitz-grade battlefield victory, but had no cavalry to follow it up. Naturally, when Napoleon was lost, France lost a huge edge.
Corroborating this argument, the French during the revolution before Napoleon were not all that good. Swarms of infantry with high morale often overwhelmed the enemy with halberds, but French wars following the coup against Robespierre were often fought for the purpose of plundering and to get rid of unemployed youth. For all intensive purposes, there was no inherent "French superiority" outside a temporary increase in quality of command.
The Germans were not a group of "small states" - the combined, expanded Prussia (which annexed many territories after its war with Austria) and South German allies outnumbered the French.
The Prussians beefed up. A triumvirate of Bismarck, General von Roon, and General von Moltke the Elder introduced key innovations in the Prussian army. These included the needle rifle, a bolt-action rifle, a General Staff that would plan and anticipate battles before a war began, comprehensively studying campaigns, the powerful Krupp artillery, and mission-type tactics. The last involved training Prussian officers to train for roles 2 ranks above them, so they could quickly make independent decisions without waiting on orders from high command.
Prussia's mobilization system was better. Von Moltke had predicted mobilization to be highly important. French generals believed in Quality over Quantity, and paid the price. In the French mobilization system, troops had to arrive at a regional district often on the other side of France as themselves, and join the front. The Prussians formed their reserve units based on provincial lines, so locals had to travel only several miles to join their units. Primary sources often describe the French mobilization as a disaster, with carts cluttering the road and jams lasting hours at a time.
Politics - Napoleon III had increased opposition and slower physical and mental faculties in his older years, and was unable to pass his requested expansion of the army. The French legislators preferred a small, professional army.
Politics again - The French army had zero offensive plans, the only plan was defensive. This was probably sensible. However, French politicians and newspapers agitated for Napoleon to "attack before Bismarck was ready". This ended in total disaster. If the French had held back and given time to their inferior mobilization system, they could have fought a better fight, but instead they found themselves encircled in Eastern France.
You could probably deduce this by now, but vast differences in the abilities of the leadership. Napoleon III was no leader, he was a collective follower. He tried to please everyone and anyone. This worked in internal politics, but not in the focused sport of war. At one point, one of his Marshals asked him to deviate from the plan and send reinforcements. Napoleon III replied back, "I trust you" and headed to the source of the fighting, causing his army to be surrounded and destroyed before arrival at Sedan. Napoleon III was never in command, he was being commanded, either by his legislature, his marshals, or even his newspapers. von Moltke in contrast had a clear chain of command and sent clear instructions, having worked out the plan beforehand. He deviated only with great care, and remained focus on his goals of encirclement and besieging Paris. Bismarck shielded him from the papers and politics so he could focus on his military job instead of responding to the whims of papers and the legislature.
In summary:
There was no "French decline". There was a temporary French glory driven by Napoleon's military and administrative energy. France did not improve as quickly in the post-Napoleonic years, as Napoleon III was preoccupied with internal politics. Bismarck, in contrast, stomached internal conflict and turmoil to push through military reforms and achieve the objectives of state on an international scale. Finally, when it came down to the showdown, France from 1803-1815 found itself with a highly competent, domineering man at the helm, while France in 1871 found itself with an indecisive emperor, inexperienced in war, being led around by his Generals.
Sources:
Wawro, Franco-Prussian War
J. Black, the Franco-Prussian War
Blundering to Glory