The war of 1866 was originally a war between Austria and Prussia and their allies within the German Confederation. Italy declared war on Austria and later France to fully control the Italian peninsula. France would join the war on the side of the Austrians and assure their victory.
Austrian aims were not focused on territorial gains, they wanted to secure their status as the most powerful German nation by weakening Prussia. Some of the German states that fought with Austria were given small bits of Prussia and her allies, Hanover for example annexed Oldenburg. The only territorial gain by Austria themselves was the Prussian province of Silesia, denying them the iron and coal deposits that existed there. The province of Schleswig was allowed to hold a plebiscite on whether to rejoin Denmark. The result was that the northern part of Schleswig joined Denmark while southern Schleswig united with Holstein and became an independent duchy. The Italians did not lose any land after the war, but were forced to accept the existence of the Papal States and the Kingdom of Lombardy-Venetia.