Many accounts from numerous Japanese veterans and civilians make it clear that they were absolutely certain that all 100 million Japanese would be utterly annihilated in a US invasion, and that surrender was not an option. There was a ‘peace faction’ among the people and government, but it was too small to make a significant difference. Why didn’t the emperor agree with virtually all his subjects? Why would he make them do precisely what they didn’t want to do?
Well, this is somewhat of a mischaracterization, at least as far as the army and navy high commands were concerned. Both branches operated largely independently of each other, but both agreed that Japan needed to surrender, but on what conditions. The navy agreed with surrendering unconditionally or largely unconditionally, but the army wanted to keep most of its overseas possessions it had gained before the Second Sino-Japanese war. This was due to their differences in success and what they thought was possible in the war, but Hirohito had early on expressed his regret for the war.
The army thought it could bloodlet America into conditions by committing to a successful defense of the home islands. They thought it would be successful because they still had a functioning military that had been withdrawn for defense. Moreover, many historians considered the US planners to be overly optimistic as they underestimated the size of the Japanese force, and its increased effectiveness in defense and kamikaze attacks. The navy on the other hand had been absolutely destroyed, with a small fighting force starving on the far flung Pacific islands, whereas the military had China on the run at that point.
Moreover, many in the public were completely unaware of Japan's situation. It is easy to say they were for the war when they thought they were winning, but the public was ready for an end near the end. They did not pick up an continue fighting on their own, and America became wildly popular during occupation. They viewed and still view the military as betraying the people and leading them into war, partly due to the military outright lying and censoring information to the people right up until Tokyo was firebombed. Either way, no the public was not largely ready to all lay down their lives, but they would have been used by the military in defense.
Lastly, the army wanted to surrender in what it deemed as an honorable peace, and unconditional surrender was essentially viewed as a complete defeat and was therefore unacceptable to many of the fatalistic elements of the military. But, that was when the military thought they could win. Russia's invasion of Northern China changed that. The military thought they could convince America to peace terms by communicating through Stalin, even though they viewed Russia and Communism as ultimate enemies. Well that possibility was quashed when Stalin agreed on only unconditional surrender and declared war. Moreover, the invasion had completely wiped out the military in Manchuria (N China). That final loss of face really gave the military any hard excuse to continue the war.
Hirohito had also wanted peace, but you must remember it was dangerous for him to ask for it. Many high ranking officials had been assassinated when they showed resistance to war, not least a finance minister that cited America's economic might. There was a cadre of fatalistic militarist terrorists that would constantly plot to draw Japan towards war, and the higher ups supported and also feared these militarists. Hirohito could be replaced. They knew he was not a god with magic powers and that he could be physically taken because they tried to do exactly that when he announced his intentions to surrender. There is a whole theory that the reason Japan surrendered and cited the nuclear bombs as the reason was because the higher command could not surrender without a ton of justification towards their military, because the military might replace even the higher ups. It is important to understand that each individual player was under threat as Japanese officials were constantly assassinated and terrorized for simply holding wrong opinions, let alone attempting to surrender.
Moreover, the Japanese command estimated around 20 million casualties, civilian and military, from an invasion. That was a quarter of Japan, and that is a huge amount when compared to western nations. However, it was not the entirety of the Japanese population.
Hirohito was called in to break the tie between navy and army voting for peace on the Supreme War Council. He then successfully did so once the atomic bombs were dropped and the Soviets invaded Manchuria, having ample justification to surrender unconditionally. He had to send his own family to communicate the order as the Japanese army might not have listened, thinking the emperor had been forced to order that.
Lastly both sides navy and army agreed, we will have to negotiated with America and give concessions because we will lose this war completely if America decides to pursue it. The higher command was not so fatalistic as many junior officers, and were afraid of them. Hirohito wanted a peace and eventually got his chance at it. It is hard to know how the population would have felt about complete destruction, as the fatalist elements had successfully suppressed free speech in Japan, but they were plenty excited that the war was over. Not every person in Japan was walking around in lock step chanting death before dishonor to the emperor, and hellbent on dying to the last person. But many in the military did think like that, especially officers commanding in the field.