Some notes:
+ By August 1945, the Japanese KNEW they could not win the war. The issue was getting the very best surrender agreement. They COULD make the Americans busy and dying (which they STILL believed would mean the American public would push for peace), while about all they had left was the civilian population willing to die (a population only partly armed), this would not win the war but could make the Americans more willing to talk. Now that the war in Europe was over, the Japanese believed Americans wanted peace in the Pacific, too. Potsdam demanded no conditions... they needed to change that (and in a way, they did).
+ Japan and the Soviet Union had an agreement, that neither would attack the other. The Japanese really hung on that. But on the day the second bomb was dropped, the Soviets declared war on Japan and came running across China heading for Japan as fast as tanks could go. THIS (Japanese historians stress) terrorized the Japanese leadership! The Japanese HATED the Russians. With the Americans, they might get a reasonable resolution to the war and reasonable occupation, but the Russians would take over Japan with Stalinist dictatorship (or at best, Japan would be divided by the Americans and Russians). Japanese historians THIS is what caused the Japanese leadership to decide they had to surrender NOW, accepting whatever they could from the Americans. A lot depended on the Emperor. His chances with the Americans was good, his chances with the Russians was zero.
+ And Japanese historians point out: this was very wise. They got a condition (their Emperor remained), the American occupation was amazingly good and short. Americans totally ignored the Russians and kept them entirely out of everything. "War crimes" were not widely pursued by the Americans. Indeed, Japan got off a lot better than Germany and Eastern Europe did.
+ American historians put more emphasis on the two bombs. And there does seem to be something to that; the bombs DID had a big psychological impact on those who at least saw it. And certainly underlined the point that Japan could not prevail here. IMO, both American and Japanese historians are right, both played a role. IMO, it's likely the sudden involvement of Russia was probably the bigger factor but both were important. A "double punch."
A side note, just my own thought: The Russians knew we had the bomb (spies in the Manhattan Project). And while they had massive troupes on the Chinese boarder ready to go, the "go" was the same day as the dropping of that second bomb. I doubt this was a coincident. It seems very plausible to me the Russians felt those bombs would bring an end to the war - and they wanted to be a part of this just as they had in Europe, thus the declaration and very quick and massive move on that very day. I think the two events are related. While sitting at the border,the Russians had no intention of getting involved in a bloody year-long invasion (let the Americans die) BUT now that America chose to use the Bomb, the war would end FAST so they needed to move now, and fast to get into the occupation. While the Japanese MAY not have been moved significantly by the Bomb, the Russians were!
.