The Gemara in מסכת ברכות says that when one shows embarrassment for his sins, he will surely be forgiven. There are two examples of this from the Tanach.
The first was Yosef’s brothers who demonstrated real shame for what they had done. The Pasuk says, אבל אשמים אנחנו על אחינו, but we are guilty because of our brother. It was important for Yosef to see that they were really sorry about what they had done.
The second example was with Shaul Hamelech at the end of his life. He was guilty of having eighty five Kohanim killed by Doeg Haedomi. As he approached his final war with the Plishtim, he was so desperate that he consulted a sorcerer who brought Shmuel’s soul to speak with him. Shaul was too embarrassed to admit that he could not get an answer from the אורים ותומים on the Kohein Gadol’s breastplate. This embarrassment allowed Shmuel to tell him that, “Tomorrow, you will be with me.” His embarrassment and falling in battle would be a complete atonement and allowed him to go down in history as בחיר ה׳, the chosen one of G-d.