Our Sages were great realists. They understood the complexities of the human condition and how even otherwise great people can make terrible, even tragic mistakes, both intentional and not. They of course picked this up from the Torah itself where the greats of our tradition are portrayed in all their greatness - and their weaknesses. It is often specifically these weaknesses that can help us most, serving as our role models when we stumble.
 
"They used to bring her to the high court in Jerusalem" (Sotah 7a). The sotah ordeal is about to begin - an ordeal we want to avoid if we can. The court urges the woman not to be afraid to confess if she has had an affair. After all "there is much that wine does, there is much that frivolity does, there is much youth does, there is much bad neighbours do." While having an affair is a most serious violation of moral standards - a sin on account of which one should give up their life rather than commit - it can happen in moments of weakness. We all know how people can act when a little inebriated or under peer pressure. Admit the momentary lapse we urge her and then move on with life. 
 
Of course if she is truly innocent of the charge she should not admit to a sin she did not do - and having endured this ordeal (even if she acted in ways to give credence to the charge of infidelity) the Torah promises that she will be blessed. But outside of the wife and her suspected lover no one actually knows what happened. Thus if no confession is coming the beit din continues and "says things that would be better not to hear."
 
The Gemara in beautifully ironic style elaborates on what exactly are those things that would be better not to hear. "Yehuda admitted and was not embarrassed and what was his end? He inherited the world to come. Reuven admitted and was not embarrassed, and what was his end? He inherited the world to come" (Sotah 7b). 
 
Both Reuven and Yehuda committed grave sexual sins. While the exact nature of Revuen's sin is debatable - did he actually sleep with his stepmother or only 'rearrange her bed" (see here) for further discussion) - Yehuda's sin is all too clear, sleeping with a prostitute - and his daughter-in-law no less[1]. Yet despite their sin because they were willing to own up to it they were not only forgiven but they were rewarded both in this world and the next. As Rashi explains Yehuda was granted the political leadership, kingship, of the Jewish people and Reuven was the first to get a share in the land as their wish to settle on the "other side" of the Jordan was granted[2]. Lucky is the nation whose leaders can admit to mistakes and sin. 
 
When reading this Gemara one almost gets the feeling that this woman is most fortunate - having the opportunity for repentance and even great reward. If done with sincere regret she can join the illustrious club of penitents who "in a place where they stand the totally righteous cannot stand" (Brachot 34b). 
 
Yet despite the greatness of admitting sin it is, as we all know (and likely experience), most difficult to do - especially publicly and especially a sin on the magnitude of adultery[3]. Thus the Gemara asks what prompted our biblical figures to confess. Furthermore generally it is best if we confess our sins to G-d alone and not mention them publically - unless there is a compelling reason to do so. Regarding Yehuda the compelling reason is obvious - preventing Tamar from being burned at the stake[4]. As to why Reuven confessed the Gemara explains he did so lest one of his brothers be blamed for his actions[5]. Wow!
 
We beseech the sotah to follow in the footsteps of these biblical greats who also sinned; for her own benefit[6], the benefit of those who witness this sad spectacle and for the benefit of the "His great name that is written in holiness that it should not be erased in the water" (Sotah 7b).
 
[1] While he did not know it was his daughter-in-law Tamar only dressed as a harlot because Yehuda reneged on his promise to let his third son marry her.
  
[2] This is a most fascinating reward as the desire of 'Reuven' to settle outside of Israel is generally viewed negatively. Nonetheless that was their desire and their wish was granted after negotiating the terms of settlement with Moshe.
  
[3] Even in the all too loose standards of today thankfully (most) people still try and hide their infidelity. Hence the desire for total secrecy of sites like Ashley Madison and the tumult generated when its database was hacked. 
  
[4] To embarrass oneself in such a situation is most praiseworthy, to embarrass others is not. Hence Tamar remained silent teaching "that it is better to throw oneself into a fiery furnace and do not whiten the face of others in public (Sotah 10b).
 
[5] This response seems to be in agreement with the view that Reuven "only" rearranged the bedroom furniture of Yaakov and Bilha's tent; whereas the thrust of the Gemara seems to indicate the sin was in the sexual act itself. This "possible contradiction" should have no impact on the message of the Gemara.
  
[6] If she is guilty and does not admit it the Torah warns of that "her belly shall swell, and her thigh shall fall away; and the woman shall be a curse among her people" (Bamidbar 5:27).