The second bomb made it clear that the first one was not a one-off, and that the US was going to nuke the cities one by one. The Japanese also had intelligence (that turned out to be false) that Tokyo was the next target.
I've read a couple accounts by anti-nuclear activists who held that the USSR was the reason for the surrender, but if you compare those accounts with the ones written by historians, the former are crackpots.
An invasion of Japan would be an absolutely massive operation (see D-Day) and the USSR was in no position to mount one.
Long before Ukrainian war, I've many times talked with Russians about bombs used on Japan.
And now I must say you very important thing - Russians are so crazy anti-humanists, that this really could be reason for fears of Japanese about USSR invasion.
To be honest, I think bombs was enough to intimidate Japanese, but I think, even without bombs, Russians behavior at war, with US Land-lease technical/economical support would be enough to convince Japanese to surrender, may be later, sought.
There’s a minute-by-minute historical analysis[1], a 1967 film[2] (starring Toshiro Mifune! Gotta find this one…), a 2015 remake[3] of the 1967 film, and apparently a forthcoming graphic novel[4].
Fundamentally, the idea of “Japan” making a decision to surrender the way (say) Truman made the decision to drop the bombs is a misleading framing.
At this time, political, military and—crucially—effective police power in Japan was distributed among individuals and groups, notably the young officer corps, with very different motivations, beliefs, and principles.
The atomic bombs, the Russian invasion, the particulars of the negotiations with the US over terms of surrender… all were “merely” external forces influencing a chaotic, unstable equilibrium.
Ultimately, in some combination those forces tipped the center of that power from one equilibrium: “The war is lost, but if we surrender now internal forces will destroy Japan as a nation even if the Allies don’t.”
…to another: “The Emperor must make an extraordinary intervention to end the war immediately.”
And it was a most close run thing!
[1] https://www.tohokingdom.com/books/japans_longest_day_kodansh...
[2] https://www.imdb.com/title/tt0062041/
[3] https://youtu.be/tDgQqnDKrdI
[4] https://greenbeanbookspdx.indielite.org/book/9784805317792
summarize those please