There are at least three major reasons for the fact that Germany was united under Prussia in 1871 and not under Austria.
The first cause has to do with the relative positions of Austria and Prussia before unification. Prussia was a small outsider state while Austria was one of the four great powers of Europe. This meant that Prussia had a stake in creating change while Austria was much less eager for change. Austria would have been more satisfied with the status quo since they were a major power.
The second cause has to do with the nature of the two states. Prussia at that time had fewer internal problems than Austria did. Austria was a vast, multinational empire. It was constantly preoccupied with various problems that were essentially domestic. These were things like rebellions in Italy or in the Balkans. Prussia did not have such worries. This made Prussia more able than Austria to concentrate on unifying Germany.
Finally, there was the issue of people and leadership. Prussia had Bismarck and Austria did not. Historians argue about the impact of single individuals on history, and some would argue that Bismarck, like any individual, was not an important factor. Others, however, would argue that Bismarck’s political acumen and determined leadership were an important asset that allowed Prussia to unify Germany where Austria, with its less brilliant leaders, could not.