1). Stalin used his position as General Secretary of the Communist Party of the Soviet Union to take control after Lenin's death and cement his power thereafter. Stalin was a very efficient administrator, and his position at the top of the Party had given him unique insight into how the Party and the Soviet Union as a whole functioned. So when Lenin's death created a power vacuum, Stalin was able to outmaneuver his opponents by utilizing the organs of the state to place absolute power in his hands.
2). Prior to taking power, Stalin had used his position as General Secretary of the Communist Party of the Soviet Union to build a vast network of clients who owed their positions to him personally. When the time came for Stalin to make a move and defeat his rivals to take over as Lenin's successors, he could rely on the loyalty and support of those whose careers he'd promoted.
3). Stalin was a ruthless manipulator who cunningly pitted his opponents against each other. After Lenin's death, he entered into the so-called Politburo Triumvirate with Kamenev and Zinoviev with the express intention of crushing Trotsky, his most serious rival for power. But to Stalin, this was purely a stop-gap measure; he had no intention of sharing power with Kamenev, Zinoviev, or anyone else, for that matter. Once Trotsky had been successfully neutralized as a rival, Stalin turned his attentions to the other members of the Triumvirate, both of whom would end up being executed, as with so many others of Stalin's rivals.