GERMANY:
After WWI, Europe was so sick of war and the winners so arrogant about their position in Europe that they didn't believe war (as it had been) was likely to ever happen again ("the war to end all wars"). The treaty of Versailles assured them that Germany would be limited to a 100,000 man army, a minimal navy and no airforce whatsoever. In addition, the French built the Maginot Line, which was an incredibly strong fortification defending against any possible future German attack against them. In addition, they believed if there were going to be problems, they would have sufficient time to mobilize and counter-attack.
At that time, and in fact, right up until the war started, no western nations built a dominating military and maintained it. They "rested on their laurels". Owing to their various advantages in the past to hold the future for them.
Germany in some ways, was forced into becoming a more organized and effective force by the restrictions of the treaty of Versailles. Hitler began a serious of "build-up" programs to rearm Germany in secret. The Luftwaffe was outlawed, but a civilian flying corps was not. So very simply, Herman Guerring simply starts training future pilots in a civilian unit. The allies didn't bat an eye lash. The Germans started plans to build ships larger than allowed (in secret at first) and disguised them as other kinds of ships. Probably the most effective thing put in place was the extremely high level and quality of training given to all of the 100,000 in the armed forces. Each soldier and Officer was trained to perform the duties of 2 ranks above the one he was in. In this way, when Hitler was to expand the forces, it would be easy to promote 100,000 to fill the ranks as needed and have them competant on day 1 in leadership positions.
Finally, the Germans had a technological advantage. They produced a superior fighter plane and also superior tanks and many other guns.
Hitler then timed his political and diplomatic efforts to very carefully intertwine with other efforts.
The Germans had VERY skilled leadership and they were highly motivated. At the time they felt they were strong enough, they unvealed their refusal to follow the treaty of Versailles. Hitler quickly expanded the army from a limit of 100,000 to millions and included a revived Luftwaffe (airforce). To prepare for this Hitler had created numerous special units like the SS, the Hitler youth, etc... He had disguised some as special political parties and disguised weapons programs as other industries.
Even so, Europes leaders appeared to not believe there would be a war or at least, not a successful one. They hoped Hitler was just trying to re-establish some strength and nationalism.
Hitler did win big-time with Blitzkrieg, using the Spanish civil war to help perfet it, but it wasn't until he invaded Poland that the allies decided to get involved. At the time they couldn't imagine he would storm across Europe with the speed he did. But they were not counting on the implementation of mechanized units like Hitler had, as this was a newly emerging concept and tactic. They had not spent significant time or resources to develope modern tactics.
But even given the attack on Poland (it was over in weeks) the allies couldn't imagine the speed with which the French would be defeated. There was a major weakness in the Maginot Line. Probably one of the biggest military blunders of all time. This incredible defensive wall which covered almost all of eastern France, stopped at Belgum. The French didn't imagine that Hitler would just go around it through another country, but that is exactly what he did. He circumvented the entire defensive line, got behind it, took the rest of the France (what mattered) and then went back later and finished off the line from the rear. Hitler pushed the allies out very quickly due to that. They just couldn't react quick enough.
The rest of Europe either became his allies, thus giving him that land or quickly fell after.
Japan simply out-classed all the forces she attacked.
Don't think that the speed in which the Axis powers did this was not a big deal. All of Europe and the west were SHOCKED at the speed with which Hitler moved. Remember, WWI had taken 4 years and never got anywhere near what Hitler accomplished in a few months. So it just wasn't something they were prepared to deal with.