How did Stalin achieve power in the first place instead of Lenin or Trotsky?
Lenin was the founder of Soviet communism and its first leader. He led the 1917 Revolution that overthrew the Czars and became the first leader of the Union of Soviet Socialist Republics. Most of his reign was spent fighting the Russian Civil War that followed the Revolution, bringing the surrounding territories under Soviet control.
In 1924, however, Lenin suffered a massive stroke. On his death bed, he warned Trotsky and others about Josef Stalin, saying he did not trust him and that he would abuse his power. He could not have been more prophetic.
Stalin at this time was the General Secretary of the Communist Party. This meant he selected the candidates who could run for the Central Committee elections. No matter which one won, he would be loyal to Stalin for his job, and Stalin picked only those people he felt he could control and manipulate. While it was not intended to be such a powerful position, being General Secretary allowed Stalin to gain the leadership of the Politburo later.
He then led a purge of the intellectuals, the thinkers behind the revolution, including Trotsky, who was assassinated in Mexico in 1940.