The nature of man is inclination to things that match his whims and frequently he neglect the rights of Allah either by disobeying Him or by doing what Allah has forbidden.
Part of Allah's Mercy and grace is that He opened the door of repentance and forgiveness to the sinner.
As we all know that there is no infallible from fault but Prophets and Messengers of Allah as was reported in the Hadith which was reported by Ibn Majah and Al Albany graded it as good on the authority of Anas (may Allah be pleased with him) who narrated that the Messenger of Allah (peace be upon him) said: "Every son of Adam commits sin but the best of those who sin are those who repent."
So, all people make mistake except the Prophets and Messengers of Allah (peace be upon them). Thus, man must commit a mistake, but what is the solution to that and what should he do?
He must repent, return to Allah, and seek His Forgiveness. `Uthaymain (may Allah bestow mercy on his soul) said: "When a person commits a sin, he has to return to Allah, repent to him, regret, and seek His Forgiveness until the sin is removed." [Sharh Riyad As-Salhin]
Sins are like diseases and their cure is repentance and the asking for Allah's Forgiveness.
Ibn Rajab (may Allah bestow mercy on his soul) said: "In general, the remedy of sins is seeking forgiveness."
Qatadah said: "Verily, this Qur'an guides you to your diseases and their cure: As for your diseases, they are sins, and their cure is seeking forgiveness."
Some people said: "The remedy for sinful people is cry and seeking forgiveness. So, the one who is burdened by his guilt should ask for forgiveness frequently."
Rabah Al Qaysy said: "I have several and forty sins for each I sought forgiveness one hundred times." 
Ibn `Uyaynah said: "The wrath of Allah is a disease which has no cure." Al Hafizh Adh-Dhahaby commented on this saying: "I said: Its remedy is frequent seeking of forgiveness at night and sincere repentance." 
Therefore, of Allah's Favor on His Servants is that he opened the door for repentance until the Day of Recompense and did not close it in the face of anyone, no matter his sins are. Thus, Allah (Blessed and Exalted be He) urges us to asking forgiveness when He sys and our wish therein He said: (Blessed and Exalted be He) "And ask Allâh for His Forgiveness. Truly, Allâh is Oft-Forgiving, Most-Merciful." [Surat Al Baqarah: 199]. He also says: "And (commanding you): Seek the forgiveness of your Lord, and turn to Him in repentance." [Surat Hud: 3].
Allah (Blessed and Exalted be He) praised those who ask for forgiveness when He says: "And those who pray and beg Allâh's Pardon in the last hours of the night." [Surat Al `Imran: 17]. He also says: "And in the hours before dawn, they were (found) asking (Allâh) for forgiveness." [Surat Az-Zariyat: 18]. He also says: "And those who, when they have committed Fâhishah (great sin as illegal sexual intercourse) or wronged themselves with evil, remember Allâh and ask forgiveness for their sins; - and none can forgive sins but Allâh." [Surat Al `Imran: 135].
Allah (Glory be to Him) promised His Servants who seek His Forgiveness with forgiveness and pardon when He says: "And whoever does evil or wrongs himself but afterwards seeks Allâh's Forgiveness, he will find Allâh Oft-Forgiving, Most Merciful." [Surat An-Nisa': 110]; among other Ayahs in which Allah (Blessed and Exalted be He) exhorts us to ask for forgiveness.
The authentic Sunnah also exhorted to seeking forgiveness in many Hadiths, of which the Hadith that was reported by Muslim in his Sahih on the authority of Abu Hurayrah (may Allah be pleased with him) who narrated that the Messenger of Allah (peace be upon him) said: "By the One in Whose Hand my soul is! If you do not commit sins, Allah would replace you with a people who would commit sins and seek forgiveness from Allah; and Allah will certainly forgive them."
The Hadith does not facilitate the way of committing sins then seeking for forgiveness, but it shows the condition of a servant after his repentance and seeking forgiveness of his sins. When a person commits a mistake, Allah gives him a way out through repentance and seeking for forgiveness.
Al Munawy (may Allah bestow mercy on his soul) said: "Were you not to commit sins, Allah would have brought some people who commit sins to forgive for them because committing sins have benefits also such as lowering one's head, admitting his helplessness, and freeing himself of pride." 
Ibn `Uthaymain (may Allah bestow mercy on his soul) said: "This is an exhortation that when man commits a sin, he should seek forgiveness because when he seeks forgiveness sincerely, Allah shall forgive him. Allah says: "Say: O 'Ibâdî (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allâh: verily, Allâh forgives all sins. Truly He is Oft-Forgiving, Most Merciful." [Surat Az-Zumar: 53]. [Sharh Riyad As-Salhin]
Of the Hadiths reported about exhorting Muslims to seek forgiveness is the Hadith which was reported by Imam Muslim in his Sahih on the authority of Abu Hurayrah (may Allah be pleased with him) who narrated that the Prophet (peace be upon him) reported from the Lord (may He be Glorified and Exalted) who says: "A slave committed a sin and he said: O Allah, forgive my sin, and Allah said: My slave committed a sin and then he realized that he has a Rubb Who forgives the sins and punishes for the sin. He then again committed a sin and said: My Lord, forgive my sin, and Allah (Glory be to Him) said: My slave committed a sin and then realized that he has a Lord Who forgives his sin and punishes for the sin. He again committed a sin and said: My Lord, forgive my sin, and Allah (Glory be to Him) said: My slave has committed a sin and then realized that he has a Lord Who forgives the sin or takes (him) to account for sin. I have granted forgiveness to my slave. Let him do whatever he likes, for I have forgiven him."
It was also reported in Sahih Muslim on the authority of Abu Hurayrah (may Allah be pleased with him) who said: I heard the Messenger of Allah (peace be upon him) saying: "A servant committed a sin... and said three times "committed a sin" and in the third he said: I have forgiven My Servant, so let him whatever he wants."
The meaning is: Seeking forgiveness is not correlated with persistence on sins because of what has been reported in the narration about Abu Bakr As-Siddiq (may Allah be pleased with him) who said: "He who asks pardon is not a confirmed sinner, even if he returns to his sin seventy times a day."
So do despair of the Allah's Mercy no matter how your faults and sins are, even if your sins reach the sky and you do not count them, you have to repent and seek forgiveness. It was reported in the Hadith which was reported by At-Tirmidhy and Al Albany graded it as authentic on the authority of Shaddad ibn Aws who said that the Prophet (peace be upon him) said: "I ask You for the good that You know and I seek refuge in You from the mischief that You know. And I seek Your forgiveness for (sins) that You know. Indeed, You are the Best Knower of the unseen."
A poet said:
I seek Allah's Forgiveness for the sins He knows
the wretched is the one upon whom Allah does not bestow mercy
How patient Allah for those who do not fear Him!
all people commit mistakes but Allah observes patience
So, seek forgiveness from Allah for your faults
how successful is the one who abstains from what Allah dislikes
how successful is the one who has done well
how successful is the one who has abstained from what Allah has forbidden.
"And whoever does evil or wrongs himself but afterwards seeks Allâh's Forgiveness, he will find Allâh Oft-Forgiving, Most Merciful." [Surat An-Nisa': 110].
We conclude with the saying of the Most Truthful who says: "And verily, I am indeed forgiving to him who repents, believes (in My Oneness, and associates none in worship with Me) and does righteous good deeds, and then remains constant in doing them, (till his death)." [Surat Taha: 82].
May Allah guide us all to the things that please Him. May Allah make you and us avoid all things He hates. And peace be upon our Prophet Muhammad, his family, and all his Companions.
 Jami` Al `Ulum Wal Hikam, (p. 397).
 Siyar A`lam An-Nubala' 12/344.
 Faydul-Qadir 5/331.
 See: Jami` Al `Ulum Wal Hikam [397-398].
Please write: COMMENT in this box to verify that you are human