Lenin’s death helped Stalin become leader. This is because it gave him the opportunity to organise Lenin’s funeral, which ultimately allowed him to project himself as Lenin’s heir. Because he organised the funeral, Trotsky did not attend because Stalin gave him the wrong date, which made Stalin look much closer to Lenin.
The fact that there had not been any other leader of the Bolshevik party apart from Lenin meant that there was no leadership issue before. The two main candidates were Stalin and Trotsky. Trotsky wasn’t very popular within the party as members thought of him as lazy and arrogant, he was a middle-class intellectual and was formally a Menshevik. This meant the party could not relate to him and his position as Commissar of War made him seem further away from the Party. Trotsky was given the advantage because he was working class and his position as General Secretary causes the members to feel that he was closer to the Party.
The party was much centralised. This helped Stalin because he was made General Secretary of the Party. Being this made it very easy for him to control the Party through the Secretariat. He had also been appointed Commissar for Nationalities, Liaison Officer between the Orgburo and the Politburo and head of the workers and Peasants Inspectorate. Because he had all of this experience within the party he had very good organisational skills and knew how to make the Party secretariat into a major power base.
Furthermore, because he was General Secretary, Stalin had the opportunity to recruit whomever he wished, which means the people who he appointed would like him. This also meant he was allowed to sack the members who sided with the opposition and every time a leading politician lost, it would be followed by a purge of his supporters.
Another advantage to being general Secretary was that he had the central influence over local Party affairs. This resulted in delegates who supported Stalin would be elected into the Congress and the Central Committee. This made it easy for him to win votes from the Party Congress.
The fact that Stalin wasn’t ever committed to any one policy also gave him an advantage. He was on the Right against Trotsky, Kamenev and Zinoviev and on the left against Tomsky, Rykov and Bukharin. This shows that he was obviously trying to gain support and was being tactful in the way he gained it.
Stalin didn’t ever take his opponents on at the same time but preferred one at time. Since Trotsky was his main opponent he was expelled and sent to Alma Ata. Also, Kamenev and Zinoviev were dismissed as Chairman of the Party. This meant that he didn’t have many opponents left and ultimately caused him to have greater success in gaining control.
All of these including several more points helped Stalin to gain control over the Bolsheviks party.