The Nazi-Soviet Non-aggression Pact, signed by Molotov of the USSR and Ribbentrop from the Third Reich, completely surprised all of Europe, and changed the face of the political scene. Indeed, one of the key axioms of Hitler's Nazi ideology had been hatred of Communists. Why then was this treaty signed? To answer this question, we look at the terms of the treaty. It first established that neither would in any way inflict any act of violence on the other, either individually or as part of an alliance. Also, neither would support the actions of a third power against the other country, nor participate in an alliance that is aimed at attacking the other. Finally, it was agreed that this pact would last for ten years. However, other clauses also came along with this agreement, namely the Secret Protocol. Eastern Europe and the Balkans were divided between into spheres of influence, while sharing Poland equally along the Narev, Vistula, and San Rivers . Also, Stalin agreed to provide substantial amounts of oil to Hitler from the Baku oil fields. Hitler certainly stood to gain from the treaty, as merely a cursory glance shows. Stalin benefited too, as evidenced by his occupation of parts of Poland along with Germany. Thus, the circumstances rendered such an agreement mutually acceptable by both parties. However, such a treaty made Germany's military plans all the more probable and menacing.
Thus we first look at reasons for Stalin to sign the treaty. Prior to the agreement, Stalin had been contemplating allying with France and Britain, forming an entente similar to the one during the First World War. However, France and Britain did not return the desire, choosing instead to ignore Stalin. However, a situation where Germany invaded Poland, as it threatened to, without Russia being allied to any other countries would have been to its disadvantage, as they would surely have lost Poland to the Germans.