Sorry if the question is worded a bit weird, I meant for it to include the German and North-German Confederation as well as the German Empire. He was minister-president under Wilhelm I while the latter was the Prussian king, and chancellor while Wilhelm was emperor, but seems to have been far more influential than him - enough so that the first part of the German Empire is now known as the Bismarck era. How did that happen, politically speaking?
So, following the Revolutions of 1848, the Prussian King was forced to accept the rule of a Parliament. That Parliament was given sweeping powers to regulate finances, and pass domestic legislation (although it was throttled by an unrepresentative constitution and a elite upper body that could veto legislation. It was designed to only give the nobility, the kings men, power. But thats another, far more complicated, issue.) This Parliament was the source of Bismarck's initial success, and his first triumph.
See Bismarck had been kicking around Prussia for some years. He was a notable, and his mother knew the right kinds of people. But Bismarck had never really demonstrated his talent (except for his mastery of German, which he regularly demonstrated). But, important to our story, Bismarck demonstrated two things to his fellow Junkers. He proved, repeatedly, that he was a loyal monarchist, and that he was a firebrand who tenaciously fought "liberalism" (in its 19th century definition).
In the early 1860s, the Prussian Parliament got angry. Really it got Socialist, and they were perpetually angry. These radicals sought to use the new constitution to push for domestic reforms and (importantly) increased control over the state. To do this, pulled on the most important part of the state: the purse strings. King Wilhelm I wanted to build a bigger army (Prussians like big, shiny armies. Especially Wilhelm, who loved his army). Parliament couldnt say no, but they simply refused to fund it. Wilhelm got really sad, and was going to abdicate. But instead, he was reminded of this monarchist, fiery Prussian Junker serving in the diplomatic corps. Bismarck had been described as a person
[O]nly to be employed when the bayonet reigns without reservation
and he proved his worth against the Prussian Parliament. Through his appointment to Minister President, Bismarck was man in between Parliament and the King, they had to argue through him. But what Bismarck did was ingenious, he simply cut Parliament out of the loop. By using legal loopholes, and massively reorganizing the Prussian tax system, Bismarck was able to support the Army and pay for the new upgrades that Wilhelm was looking for. In that one move, he castrated the Parliament, and showed everybody who was really in charge, the king.
And the king was well aware how useful Bismarck could be, so he kept him around. Bismarck, for his part, continued to prove his usefulness by guiding Prussia through a series of wars (which he provoked), which made Bismarck look smarter and smarter. But how did that happen?
Well, remember, the Parliament had its fingers in a lot of pots in Prussia, and they reported to Bismarck. Plus, Bismarck was the MP for Wilhelm, who really liked Bismarck. And Wilhelm didnt much care for statecraft, politics, and all that. He like his army, remember? So Bismarck was afforded the latitude to set (and manipulate) policy as saw fit. And, had Bismarck failed Wilhelm at any point, he would have immediately been on the outs. But Bismarck was the goose that kept laying the golden egg, and so Bismarck kept getting things the way he wanted them.
Plus, Bismarck had the terrible habit of collapsing into a nervous wreck every time the king/emperor denied him. There was some kind of Freudian thing going on with Bismarck, and he really sought some kind of validation from Wilhelm, his father figure. Or Bismarck was a twisted bastard who used every trick to manipulate Wilhelm into giving in. Regardless of motivation, Bismarck would sometimes throw a tantrum, crying and rolling on the ground until Wilhelm would give in and give Bismarck what he wanted. Which was usually good for Wilhelm anyways.
After unification, Bismarck was like a god among mortals. He seemed to be a political genius who could do no wrong. Things went great until Wilhelm died, and Frederick had the indecency to live 4 months after his coronation. Wilhelm II, who was 29 when he took the throne, had little need for the stinky old man, who had anyways lost much of his previous luster. Plus, Bismarck had gotten used to running the German state, Wilhelm II's state. And that just wouldnt do. Plus there was this whole bit about socialists and maybe Bismarck wanted to throw a coup. But coup or no coup, Wilhelm II was more interested in running Germany than Wilhelm I had been, and Bismarck's old tricks (and old glories) no longer worked on the new, young, probably crazy, Kaiser.
I would really recommend Steinburg's Bismarck: A Life. Its the best single volume biography of the Mad Junker out there.
Politics. While he wasn't the highest in terms of authority, always serving monarchs, he was very high relatively. Not only that, but as monarchs, Freidrich and Wilhelm were both divorced from the increasingly important world of parliamentary politics. Bismarck however, was a part of it, and was able to very effectively play off the two groups, parliament and the monarch, in his capacity as the connection between the two groups. The fact of the matter is that Freidrich and Wilhelm both relied on him (for as long as they did) because they felt he was the best man to control the Reichstag (the imperial German and North German parliament). This indispensability is what gave Bismarck his power and the ability to force his decisions through, sometimes against the wishes of his superior (the monarch).
Sources: - http://www.amazon.co.uk/Iron-Kingdom-Downfall-Prussia-1600-1947/dp/0140293345 - http://www.amazon.co.uk/Bismarck-Life-Jonathan-Steinberg-ebook/dp/B0052XUFNM/ref=sr_1_1?s=books&ie=UTF8&qid=1401026902&sr=1-1&keywords=bismarck