It's complicated but most of it comes down to two things. First, was Napoleon III's domestic situation. He had fashioned himself as a second Bonaparte and there were two main aspects to Bonapartian politics, domestic modernization and foreign domination through military victory. While Napoleon III had succeeded quite well at the former (really exceeding his uncle) he had only moderate foreign successes and a few blunders to his name. Napoleon III and his ruling clique became convinced that a good old fashioned European land war was the only thing that could keep France united and legitimize the second French Empire. And there may have been some truth to this. Regardless, they saw it as vital to maintaining the "Empire" which they believed had brought France out of a dark historical period.

Second, was what about what German unification did to what we call "The Balance of Powers". "The Balance of Powers" is a concept that things are good when there are several European powers who have relatively balanced economic and military powers. But that things get very bad when one power becomes dominant and seeks to annihilate or mortally wound its counterparts. It was a concept favored by the high born, elite educated aristocrats who made up the ministers in Europe's Empiral bureaucracies. To this view, things which might disturb his balance are bad and things which maintain the balance are good.

For over a century, the unification of Germany had been one of those "bad" things which might come to pass. It loomed as a boogieman over the old European, "Balance of Powers". Independently, the German speaking states of Northern Europe had become the most economically developed parts of the continent. There was a feeling that if they joined together, their economic power and as a consequence, their military power would eclipse all of Europe. And this was not just the feeling of the French. The Russians were concerned about this question. And the Austrians too. They had the most complicated situation of all because many of the German states had been part of The Holy Roman Empire which had Austria had dominated. As the German states rose, many Austrian aristocrats benefited but they also understood this rise as a threat. Thus they had worked against German unification for decades.

I think the French figured that smashing an infant German state before it had time to develop cohesion was there best chance to avoid German domination. This of course was a blunder. The war pushed Southern German States into unification and created the popular basis for a cohesive German nation.

Now, regarding the infamous "insult" which was the French excuse for war. The insult itself is not really important. The French and Germans both were eager for the war. France for the reasons stated above, Germany for the reason that they figured it would bring the South German states into their union. The French were looking for a reason and Bismarck with his publication of the Ems Dispatch obliged them. In the end, it could've been almost anything.

As a foot note, there is a ton of debate about whether "The Balance of Powers" was really the product of the magnanimous wisdom of conservative ministers or whether it was just an inescapable reality which they accepted, it being simply too hard to project power at the scale necessary to dominate all of Europe at this time. Regardless of its root intention, "The Balance of Power" is something we see at work in European politics. The treaties that ended European wars from the thirty years war until the Franco-Prussiian war were rarely very punitive. Usually they attempt to give the victor some kind of upper hand but they don't usually involve measures that another power might feel they truly cannot accept. They indeed often look as though they are trying to create some kind of stable peace.