There are many different reasons why Stalin and not Trotsky became Lenin’s successor. When Lenin died he left no clear successor to lead the Communist Party, so it was assumed that Trotsky was going to be Lenin’s successor, because Trotsky was very close to him. Also he was in charge of the red army on the evening of 24th October 1917, that’s when they took over most of Petrograd, which is the Bolsheviks headquarters, and he was the one who also signed and had negotiated the Brest-Litovsk on 3 March 1918.
Stalin was a normal person like most of the Russians in Russia, he had a poor upbringing, and he was the only Bolshevik who had upbringing like that, so some of the poorer Bolshevik supporters saw him as a man of the people. On the other hand Trotsky was highly educated and he was a thinker, this raised jealousy and suspicious among the communist party. Trotsky was so arrogant, people were afraid of Trotsky by most of the seniors in the Bolshevik party, because Trotsky offended most of them. Trotsky failed to realise that he needed them to support him when they voted for one of them for a new successor.