Part 1
There wasn't any one singular reason why Japan made the decision to surrender. A combination of the utter destruction of their Navy, critical shortages of resources due to an American blockade of the Home Islands, the Atomic Bombings along with the firebombings of Japanese cities, the Soviet Invasion, and the Emperor's intervention all played into Japan's final decision to surrender. Lets take it piece by piece.
Destruction of the Japanese Navy
The Battle of Leyte Gulf in October of 1944 was a disaster for the Japanese Navy, with their defeat costing them their last fleet carrier, 3 light carriers, and 3 capital ships, among another 20+ lost cruisers/destroyers. After the Japanese defeat there, the Navy had no realistic means to resist the United States Navy anymore, and Japanese defeat in some form was all but assured. From this point on, negotiations would commence between the members of the Supreme Council for the Direction of the War regarding terms of a negotiated peace.
The Supreme Counsel for Direction of the War
Formed in 1944 by Prime Minister Kuniaki Koiso to negotiate terms for a negotiated peace to the war, efforts to negotiate any terms such as the retainment of conquered territory in China and Southeast Asia were immediately fruitless, namely because of the Allied agreement of only accepting the unconditional surrender of any Axis Power during the Casablanca Conference in 1943.
By the end of the war, this war counsel would comprise of 6 members, separated into 2 camps when it came to ending the war, the Hardliners, who would never accept unconditional surrender and favored one last decisive engagement to defeat the United States (namely, throwing back an expected American landing on the Japanese Home Islands), and the Peace Camp, who favored a negotiated peace with the Soviet Union acting as a potential mediator for peace. The Counsel members in the leadup to the surrender were:
Prime Minister of Japan: Admiral Kantarō Suzuki (Peace Camp)
Minister of Foreign Affairs: Shigenori Tōgō (Peace Camp)
Minister of the Army: General Korechika Anami (Hardliner)
Minister of the Navy: Admiral Mitsumasa Yonai (Peace Camp)
Chief of the Army General Staff: General Yoshijirō Umezu (Hardliner)
Chief of the Navy General Staff: Admiral Soemu Toyoda (his position's a bit complicated, he was firmly against accepting the Potsdam Declaration but also open to seeking favorable terms for surrender, so, soft Hardliner)
Unconditional Surrender and The Pursuit for Peace
While the Counsel Hardliners vehemently opposed surrender in any capacity, Foreign Affairs Minister Shigenori Tōgō instructed Naotake Satō, Japan's ambassador to the Soviet Union, to solicit Soviet support in mediating a peace conference between the Allied Powers and Japan. Months of back and forth between Satō and the Soviet Union would be exchanged like a broken record. Sato would ask for Soviet mediation to end the conflict, the Soviet response would be vague and non-committal, which in reality was a delaying tactic as the Soviets had no intention of mediating peace, but were intending to invade Japan and join the Allied Effort.
During the Tehran Conference of 1943, it was secretly agreed that the Soviet Union would join the war against Japan shortly after the Defeat of Germany, should Germany be defeated first. During the Yalta Conference in February of '45, Roosevelt and Stalin agreed on the specifics of Soviet entry into the war against Japan. The Soviets were to enter the war within 3 months of Germany's surrender, as to provide time for the Red Army to move its troops to the border of Manchuria and iron out all the supply and logistics needs of an invasion of the Japanese Empire. In exchange, Stalin was promised the return of territory lost in the 1905 Russo-Japanese War, namely the return of Southern Sakhalin, the Kuril Islands, and Port Arthur in China.
The Japanese War Counsel didn't make much headway in their negotiations until the Allied release of the Potsdam Declaration on July 26, 1945. The declaration called on Japan to surrender unconditionally, with the only other alternative being its complete and utter destruction (It's good to keep in mind that the Trinity test was successfully carried out on July 16, 1945, so complete and utter destruction was indeed a precursor reference to use of this new weapon). Upon receiving the Potsdam Declaration, the Japanese War Counsel reviewed the document, realized the sheer hopelessness of their situation and.....immediately hit a brick wall, with no counsel members budging on their position, making no progress on agreement for peace/surrender terms. The Japanese War Counsel all agreed that unconditional surrender was absolutely unacceptable, primarily out of the desire to keep the Emperor's position intact. With no assurances that Emperor Hirohito would keep his station, the only avenues of discussion were for determining peace terms, or for seeking out one last decisive victory against the United States that would bring them to the negotiating table.
One interesting piece of the Potsdam Declaration was that the Soviet Union was not a signature party to the declaration, which gave false hope to the Peace Camp that the Soviets were not party to this declaration and would still be open to mediation. Shigenori Tōgō instructed Naotake Satō again to request mediation, again receiving a non-committal answer from the Soviet Union.
Firebombing, Blockade, and the Strangling of Japan
Before getting to the final act, it must also be noted that the destruction of entire Japanese cities wasn't anything new to the Japanese Government. Throughout 1945 with the Capture of Iwo Jima and Okinawa, large scale air raids on Japan were possible and carried out all through 1945. Incendiary bombs in particular were immensely effective at devastating the mostly wooden and paper Japanese cities of Osaka, Nagoya, Kobe, and Tokyo. The firebombings would create massively destructive firestorms in these cities that would transform the cities into a hell on earth, where the fire was so pervasive that there wasn't enough oxygen to breathe on the ground, the rivers water temperature would rise to a near boil and offer no safety to people who would jump for the river in search of safety, only to burn. The firebombings would kill up to a million Japanese civilians and leave major urban centers utterly destroyed, so its good to keep in mind that the destruction of entire cities was not a new development to the war counsel.
Another critical element in the end of the war was the effective blockade of Japan by the US Navy, with the Japanese Navy having no means to effectively break the blockade, Japan quickly began to experience extreme shortages of food, fuel, and all strategic materials needed in order to keep the military sufficiently supplied. Without an end to the war in sight, Japan was staring at a major starvation crisis on the Home Islands with all outside food cut off.