I just finished reading the book "The Collapse of the Tokugawa Bakufu". This book explains what led to the fall of the Tokugawa Shogun in 1868 and the restoration of the Emperor.
The Tokugawa Bakufu or Shoganate lasted over 250 years until its collapse in 1868. As many know, the foreign intrusion was a major factor in its demise. But by itself it was not the reason for the collapse. It was the culmination of several things that finally occurred at the same time that led to it. From the foreigners to fiscal and economic crisis to political crisis and lack of strong leadership. The foreign intrusion just provided the spark. There were many people in Japan who felt the Bakufu had disgraced Japan by giving into the barbarians. The coalition of samurai, some powerful domains, and the Imperial Court finally defeated the Tokugawa Bakufu.
The fall of the Tokugawa Shogunate was one of the great events in Asian and world history. It changed Japan from a nation of isolation to a nation that now had to not only prevent its subjugation at the hands of world powers but to become a world power themselves.
I have read several books on Japanese history. What I have come to believe is the linkage from the fall of the Tokugawa Shoguns all the way through Japan's eventual destruction in 1945. This may be an oversimplification but this is how I see how Japan moved from 1868 to 1945.
In the 1860s, Japan was officially isolated from the rest of the world. But the world was changing. Foreign powers were exerting their influence in Asia. America, France, Russia, England and others were using their power to control China and other parts of Asia. Then in 1853, the American's came to Japan in their black ships. Later, England and France threatened, and sometimes used, force to get the Shogunate to open up and forcing the Bakufu to sign unequal treaties.
With the fall of the Shogunate and the restoration of the Emperor in 1868, Japan went on a rapid program of economic and military development in order to withstand the foreign powers and eventually to grow Japan's influence in Asia.
This led to Japan's first major confrontation with a foreign power in the Russo-Japanese war in 1904. Japan defeated Russia in that war and gained the title of a world power. All this in a little over 30 years.
From that, Japan continued its goal of competing against the other powers by subjugating Korea, China and the rest of Asia and all of this ultimately led to World War II.