That's not actually true. When we bombed Hiroshima and Nagasaki, Japanese delegations were already in the process of surrendering to the United States. The sticking point was whether it was to be conditional or unconditional surrender, the sovereignity of the Emperor was actually the point of the most contention. The US figures doing the negotiation didn't realize how important this symbolic figure was, and were pushing for an unconditional surrender, while the Japanese negotiators were unable to broker any settlement that did not preserve the Emperor, though they wanted desperately to surrender.
We dropped the first bomb on Hiroshima to prove our military superiority to Japan and most importantly to the Soviet Union. They were drawing up the unconditional surrender papers when we dropped the second bomb to show the world that this wasn't a one time thing, we were prepared to use these again.
The people at the top (whether the military forces knew it or not) were well aware that Japan was ready to surrender. The nuclear weapons were used to make a political statement to the world.
There are a lot of books out there to read.