When Stalin and Hitler signed a non-aggression pact in August 1939, they secretly created spheres of influence. Besides dividing up Poland, they agreed to allow each other free reign over nations and territories they deemed important. Hitler agreed to give Stalin a free hand in the Baltic States and Finland.
This was good news for the Soviet leader. In 1918, when Finland gained its independence from Bolshevik Russia, Imperial German troops fought alongside the Finns and made the difference in the battle. This new pact meant that Germany would stay on the sidelines.
Moscow wasted no time before making proposals to Finland, in the form of demands to move their common border away from Leningrad (the Finnish border was just 20 miles from the city) and be compensated by land elsewhere. The Finns, distrustful of Russian intensions from past experience, refused, and when Finland rejected Soviet demands for territorial concessions, war was inevitable.