Nazi Germany and the USSR alliance

by mmako144

Why did Stalin ally with Nazi Germany, if Hitler stated in his book he hated communists and Slavs?

And also...

If Stalin was bribed with half of Poland if he knew about the Hitler’s hatred to his race political idea, why wasn’t he prepared for a Nazi German invasion?

reverseswang

why wasn’t he prepared for a Nazi German invasion?

Responding to this latter part: I've recently been reading The Mitrokhin Archive, originally published as The Sword and the Shield, by the intelligence historian Christopher Andrew and defected KGB archivist Vasili Mitrokhin, and it makes abundantly clear that Stalin did receive numerous intelligence warnings about, not just Hitler's plans to invade the USSR, but concrete reports of troop deployments along the border. From the 2018 reissue of The Mitrokhin Archive:

[Stalin's] belief in a non-existent British conspiracy helped to blind him to ... a real German plot (p. 120)

Stalin was a hysterical conspiracist, who was deeply untrustworthy of, above all, Churchill. He saw British conspiracies in everything, and believed that reports of the potential invasion were a British disinformation campaign designed to sow discord between the USSR and Germany. (Whether or not the SIS actually did conduct such a disinformation campaign I can't speak to.) Stalin routinely overruled intelligence assessments - he received them directly and had significant personal overall control of the intelligence bureaucracy - and would scribble sometimes extremely crude notes over such warnings swearing and criticising those who'd written about a German invasion. For example, when an NKVD agent in the Luftwaffe reported troop movements, Stalin wrote on the report:

You can send your "source" from the German air force to his whore of a mother! This is not a "source" but a disinformer. (p.122)

This level of conspiracist denial reached comical proportions. In June the German ambassador, von der Schulenberg, openly warned Russia that Hitler was going to invade. Stalin's response was "Disinformation has now reached the ambassadorial level!" (p. 123)

Post-1937 Stalin wielded, if not total, then at least a high degree of personal political control in the USSR; many of the top ranks of the military and intelligence establishments had been purged. He had also installed a sycophant in Beria, who contributed to the delusion. Beria ordered NKVD agents who reported troop build-ups to be sent to labour camps. In other words, he'd rather fuel Stalin's paranoia, than risk accurately reporting intelligence assessments. Beria's instincts for self-preservation were accurate: according to the offficial SVR history, Fitin, who insisted on continuing to send reports of imminent invasion, would have been sent to the firing squad had war not broken out. (p. 124)

Stalin wasn't prepared for a Nazi invasion, therefore, because he simply refused to allow himself to be so prepared. He was too fixated on British conspiracies. (This conspiracist mindset continued post-war, but largely became focused on perceived Zionist plots as the British faded from relevance in his views.)

Source: Christopher Andrew and Vasili Mitrokhin, The Mitrokhin Archive: The KGB in Europe and West, reissued by Penguin in 2018, chapter 6 "War"