The main reason was that the allies were prepared to fight WW1 all over again. The Germans had very different ideas. The allies were ready to fight a static trench war in Belgium. Problem was that Belgium declared neutrality in 1936.
That created huge problems for the allied planners. Allied officers were not allowed to coordinate with Belgium before hostilities broke out. Then they discovered that the positions they were supposed to occupy weren't ready.
Even worse: the Germans also violated Dutch neutrality, which caused the allies to (try) to set up defenses - for which they weren't prepared - much further north into Holland. French troops were moved to Breda (North Brabant) but never even got there.
General Gamelin set up his HQ in Château de Vincennes. FAR behind the front. In Paris itself, actually. With almost no communication with the outside world: only a few (I thought one) telephone lines. Allied communications were based on telephones with cables. The Germans used radios extensively. Allied planning was hopelessly behind actual events. Every time the French set up a defensive line, it was already bypassed by German troops.
The Germans initially planned to use the von Schlieffen plan again. Until a German plane made on 10 Jan 40 an emergency landing in Belgium with their plans. Von Manstein made a different plan, Fall Gelb (plan Yellow) which was adapted by Hitler (he presented it as his own idea) very much against the will of von Mansteins superiors.
The allies were about as strong as the German army, perhaps a few divisions stronger. A big difference was combat experience. The German had it (Polish campaign), the allies not. They had also more and better tanks, but they employed them wrongly. The Germans concentrated their armored forces into strong units with which they spearheaded their attack. The allies spread them all over they army. German air power was vastly superior to allied air power, both in machines, experience (Spanish civil war, Poland) and tactics.
German tanks, by the way, weren't very good. Later on in the war much better tanks were developed. The PzKw I and II were too small, too lightly armored and armed. But they were employed in the right way, had radios (most allied tanks didn't) and that made all the difference.
Gamelin was very old (73), not very popular with the troops (he rarely visited them) and his political masters. Premier Reynaud tried to sack him many times. Eventually he was replaced by Weygand who was even older... Replacing your commanders during a battle you are already loosing is never a good idea.
The only general that stands out positive during this campaign is Lord Gort. He made sure the BEF retreated to Dunkirk and wasn't wasted in spoiling attacks to hold the line.
The Germans did use a lot of amphetamines to get the most out of their troops, but with mixed results. Yes, they could fight much longer. But once the stuff stopped working, you had to rest. There and then. And very long, several days at least to recover. It was very useful on limited targets, such as the capture of Fort Eben Emael. Giving it like Oreos to advancing infantry units wasn't a good idea. Fortunately (for the Germans) the French high command was bad enough so it didn't matter much.
The Germans weren't surprised that their plan did work, they were far more surprised it worked so well. For example, Von Rundstedt's infamous Halt order at Dunkirk showed the German high command got cold feet. He was sure the allies had prepared a counter offensive or a big trap.