There have been entire libraries filled with answers to these questions, on how was Hitler’s lightning war so successful and why wasn’t the political will there to resist, the reasons differ by country but as you note the fall of France in June 1940 was probably the biggest shock to the Allied cause, its reasons are myriad.
In the case of unfortunate Poland, as well as having two tyrannies attack her from east and west her allies compounded the problem by urging her not to mobilise to avoid provoking Hitler. Antony Beevor in The Second World War (a good general overview) records that on the 1st of September as a result of British and French ambassadors urging them to hold back the order to mobilise had been given and cancelled multiple times, caused such chaos that only a third of Poland’s front line troops were in position.
In the case of Norway and Denmark, the element of surprise helped the Germans immeasurably - Beevor records that Germany had troops in Copenhagen before the shore batteries had even been alerted. Things were a bit tougher in Norway, the Germans lost a few ships, but at sea the Royal Navy’s partial success did not prevent 100,000 German soldiers being transported to Norway. Denmark felt they had no choice but to accept German demands, the Norweigans with considerable courage attacked already established German 3rd Mountain Division, but Luftwaffe air supremacy proved to much and the Norwegians established a government-in-exile.
In France, part of it was the effectiveness of the German army which had seen conscription since 1935 and its officers raised in the Prussian tradition, namely Manstein and Guderian who were behind the concept of the Blitzkrieg and a hitherto unthought of armoured thrust through the relatively undefended Ardennes (a view reinforced by a plane crash which revealed the original German plan of attack), bypassing the French defences of the now infamous Maginot Line.
Part of it was genuine lack of enthusiasm on the part of the troops for another war with Germany, the last of which had bled France white. The initial ‘Phoney War’ period speaks much to this, where the western allies while technically at war with Germany, didn’t really do much of anything. A commentator in London at the time reported that the war had a ‘a strange, somnambulist quality’ that spread to the front lines - a Reuters correspondent asked French troops with Germans in clear sight why they didn’t shoot them - with shock the answer came ‘…if we fire, they will fire back.’ There were myriad other faults that would take too long to give a detailed answer to, from unprepared French defences build by civilian contractors which faced the wrong way to the inadequate French air force flying antiquated aircraft against a supreme Luftwaffe, to a lethal paralysis of decision by France’s leaders who were living in denial.
This quote by a German soldier from the time sum up the chaotic response to their onslaught;
“There are many, many divisions here who haven’t fired a shot. And at the front the enemy are running away. French and English, equal adversaries in the world war, refuse to take us on now. In truth, our aircraft are in command of the skies. We haven’t seen one single enemy aircraft, only our own. Just imagine. Positions like Amiens, Laon, Chemin des Dames are falling within hours. In 14-18 they were fought over for years.”