I mean I get the timing. The elation and patriotic pride stemming from a historic victory against an arch nemesis is definitely helpful for creating a new nation and instilling its citizens with a sense of national unity. And Versailles is certainly flashy enough to fit the bill. But still, founding a new nation on foreign soil seems weird.
So what where the political reasons for doing it this way? Who came up with the idea? And for how long was it in the works? Was it always the plan, provided the war went well, or was it a spur of the moment thing, relatively speaking. Where there any prominent dissenting voices?
While it is tempting to ascribe Bismarck's motivation for the declaration in the Hall of Mirrors solely to humiliation of the Erbfeind France, there were domestic considerations at play in the location choice of Versailles. This was clear in the patterns of invitations and the behind-the-scenes maneuvering Bismarck conducted in the lead up to the proclamation of the Empire.
There were two crucial facets of German history that would have been on Bismarck's mind given his experience and subsequent actions. One, there already had been an offer of a German crown made to the Hohenzollern monarch, Wilhelm I's brother King Frederick Wilhelm IV, by the Frankfurt Paulskirche parliament in the Revolution of 1848. The Prussian King refused and Bismarck had been part of the counter-revolution that squashed the Paulskirche liberals. Although older historiography stressed the defeat of German liberals in 1848- A.J.P. Taylor famously termed it a turning point that failed to turn- recent research into German liberalism has shown it was surprisingly active post-1848 and was one of Bismarck's political rivals. His tussles with the Prussian Diet in the 1860s over the Landwehr issue had shown that while he was an adept parliamentary leader, there still was an organized opposition within Germany among its various elected bodies.
Secondly, Bismarck was also acutely aware that not all of the German princes were in favor of a Hohenzollern hegemony in the new Germany. The negotiations with the southern German monarchs for the imminent declaration of the German empire as German operations continued against the French had been tense. Bismarck had alternate between threats and bribery to ensure that these monarchs would fall in line when the time came. The Prussian Chancellor also had to contend with the reluctance of his regal master, Wilhelm I who tended to be indifferent to the issue of his future imperial title. Bismarck had to cajole the reluctant Wittelsbach monarch to appeal to Wilhelm I to accept the German crown.
Therefore it made a degree of sense to hold the declaration of the Empire in Versailles. Having a German-based declaration opened up two thorny, interrelated issues: where to hold such a declaration and the possibility of Bismarck losing control over a delicate situation. Had the Empire been declared in Berlin or Potsdam, it might alter the fragile consensus among the southern German monarchs for the Empire by emphasizing Hohenzollern and Prussian supremacy too much. A ceremony in the North German Reichstag would be a recapitulation of 1848 and cede too much symbolic power to the elected body. Bismarck's constitution had already tried to limit the power of the Reichstag and it was against Bismarck's own political instincts to give them the high ground (a stubbornness that was the source of no end of troubles as Chancellor). Delaying for a suitable German declaration spot would open up the possibility that other individuals like the Prussian Crown Prince or National Liberals could influence the tractable Wilhelm I. Having the various monarchs travel to Versailles was a way to compel a degree of supplication to the new power arrangement in German affairs. Moreover, the ceremony of the various German monarchs proclaiming Wilhelm Kaiser also sent a message that the new federal entity was based on a union of monarchs. The Reichstag was supposed to accept this as a fait accompli and as subordinate partners to their respective monarchs. Notably absent from the Hall of Mirrors was a delegation from North German Reichstag. Although some individual parliamentary leaders attended the ceremony, attempts to have the delegation meet at Versailles were rebuffed on the grounds of logistics and that a number of parliamentarians found the idea quite baroque.
While there is no doubt that using Versailles had the bonus of humiliating the French and being a symbol of reversing history, there were other motives at play in Bismarck's decision process. Versailles was convenient as many of the crowned heads and generals were already there, but this expediency was a means not an en onto itself. By making the future subordinates come to Wilhelm I, and by extension, his Chancellor, the ceremony was sending a clear message of political power. Yet these power games did not exactly thrill Bismarck; most commentators noted that he was miserable during the ceremony and he wrote back to his wife he was constantly frustrated having to deal with so many different problems to be a midwife to unification.
Sources
Lerman, Katharine Anne. Bismarck. London [u.a.]: Routledge, 2014.
Pflanze, Otto. Bismarck and the Development of Germany, Volume 1. Princeton: Princeton Univ. Press, 1971.
Steinberg, Jonathan. Bismarck: A Life. Oxford: Oxford University Press, 2013.
The Germans (or better, the Prussians and Bavarians) were actually occupying Paris and its surrounding area towards the end of the Franco-Prussian War. The main princes involved in the War were commanders for the united German force, and proclaimed the Empire after they determined victory over the French.
The loss by France to Prussia and its allies led to the toppling of the Second French Empire under Napoleon III. Due to Versailles representing the French crown and its symbolic meaning for the Germans, it's likely that's why they chose Versailles as the location.
There had long been tensions between the French and the Prussians (and their allies in the Franco-Prussian War) and where better to announce your victory and your new empire than in the famous palace of your enemy's kings? Especially given the devastation Prussian and German states suffered under Napoleon, it makes sense that the German princes/Bismarck would want to rub it in their faces. They used the same hall where Louis XIV's throne once stood, and a noble screamed "Long Live His Majesty Emperor Wilhelm!" in the same style that electors did to Holy Roman Emperors of old. And of course, this symbolic kick to the French nuts would likely be why there was so much hatred during and after WWI showed towards the Germans.
Technically the establishment of the United States was recognized in Paris as well (Treaty of Paris of 1783).
In my opinion, I see this as similar to when the Soviet Army flew the Hammer and Sickle flag over Berlin after defeating the Wehrmacht in WWII.
Sources:
Erich Eyck, Bismarck and the German Empire
Here is the German History Museum's write up about the proclamation, written by Wilfried Rogasch and Arnulf Scriba. It is in German, so it may need some translating if you don't speak German.
Here is the write-up about the proclamation from Versaille's official website.