True repentance has certain conditions that if done with those conditions, it will be accepted by our kind and compassionate Lord. These conditions are as follows: 1- Committing the sin out of ignorance and foolishness 2- Not being aware of death 3- Regretting the sin 4- Deciding not to return to the sin in the future 5- Compensating for previous mistakes 6- Asking Allah for forgiveness 7- Refraining from the sin
However, one who prefers to stay impure and insists on his sins definitely still hasn’t regretted committing them, consequently, repenting will be meaningless. Moreover, it is not clear whether or not he will repent in the future and repeating the sin may even take away the Tawfiq of repenting! Yes, if one truly repents in a way that its conditions are met, this repentance will be accepted.
Sins are much akin to a dirty swamp; the more an individual immerses themselves in it, the more polluted they become and the closer they get to destruction and annihilation. On the other hand, repentance and making a serious decision to abstain from sins is itself salvation and a great victory, which opens the doors to the mercy of God. An individual who reaches this stage (of repentance) has gained a great victory and he must do his utmost to strengthen further his intentions and inclinations towards fighting against sins. In addition, he must attempt to keep himself in this state perpetually. We must pay attention that not all tawbahs are considered true ones and true repentance has necessary conditions which are mentioned below:
1- Committing the sin out of ignorance and foolishness: the Quran says: "[Acceptance of] repentance by Allah is only for those who commit evil out of ignorance." The meaning of ignorance in this verse is broader than the lack of knowledge about a sin and it also covers the situation where one's carnal desires and instincts gain control over his intellect and faith. In this situation, although one does not lose his knowledge in regard to the sin, but his knowledge and faith is overshadowed and immobilized by his desires. When his knowledge loses its effect, it is as if he has no knowledge at all.
But if the sin was not committed out of ignorance, but rather because of opposing and rejecting the command of Allah, then such a sin reflects one's Kufr (Disbelief) and therefore the repentance of such a person will not be accepted.
2- Not knowing that he will die in the close future (repenting when he still has the chance to commit sins): The repentance of those who are on the verge of death and know it is all over for them has no value. In this regard the Quran says: "But [acceptance of] repentance is not for those who go on committing misdeeds and when death approaches any of them, he says, "I repent now."
3- Avoiding sins: Repenting is meaningless for one who is committing a sin and has still not decided to refrain from it, even if he is determined to repent and avoid the sin in the future, because he may not have the chance to ever repent.
4- Having remorse and regret: If someone is not truly regretful of his sins, he has not truly repented even if he no longer commits the sin, because he may return to it at any moment.
5- Strongly deciding to avoid the sin and not return to it in the future.
6- Compensating for previous sins and shortcomings.
7- Istighfar and asking Allah for forgiveness.
One who truly does tawbah (repentance) with the mentioned conditions should not be hopeless in Allah's mercy, because no matter how great his sin is, Allah's mercy is even greater and Allah will definitely keep his promise and accept his repentance. However, one who prefers to stay impure and insists on his sins definitely still hasn’t regretted committing them, consequently, repenting will be meaningless. Moreover, it is not clear whether or not he will repent in the future and repeating the sin may even take away the tawfiq and chances of repenting! Yes, if one truly repents in a way that its conditions are met, this repentance will be accepted.
One point of dire importance, is the special favor and grace which God bestows upon someone who repents; repentance destroys and effaces all of the sins and negative consequences of sins before God. God has mentioned in the Holy Quran that: (قُلْ یَـٰعِبَادِىَ ٱلَّذِینَ أَسْرَفُوا۟ عَلَىٰٓ أَنفُسِهِمْ لَا تَقْنَطُوا۟ مِن رَّحْمَةِ ٱللَّهِ ۚ إِنَّ ٱللَّهَ یَغْفِرُ ٱلذُّنُوبَ جَمِیعًا ۚ إِنَّهُۥ هُوَ ٱلْغَفُورُ ٱلرَّحِیمُ), which means ‘Say: "O my Servants who have transgressed against their souls! Despair not of the Mercy of Allah: for Allah forgives all sins: for He is Oft-Forgiving, Most Merciful. 
 Nisa', 17 " إِنَّمَا التَّوْبَةُ عَلَى اللَّهِ لِلَّذِینَ یَعْمَلُونَ السُّوءَ بِجَهالَةٍ "
 Tafsir Nemouneh, vol. 3, pg. 313.
 Nisa', 18 " وَ لَیْسَتِ التَّوْبَةُ لِلَّذینَ یَعْمَلُونَ السَّیِّئاتِ حَتَّى إِذا حَضَرَ أَحَدَهُمُ الْمَوْتُ قالَ إِنِّی تُبْتُ الْآنَ وَ لاَ الَّذینَ یَمُوتُونَ وَ هُمْ کُفَّارٌ أُولئِکَ أَعْتَدْنا لَهُمْ عَذاباً أَلیما "
 Tafsir Nemouneh, vol. 24, pg. 290.
 Zumar:53, “قُلْ یا عِبادِیَ الَّذینَ أَسْرَفُوا عَلى أَنْفُسِهِمْ لا تَقْنَطُوا مِنْ رَحْمَةِ اللَّهِ إِنَّ اللَّهَ یَغْفِرُ الذُّنُوبَ جَمیعاً إِنَّهُ هُوَ الْغَفُورُ الرَّحیمُ”
 Adopted from Question 2130 (website: 2239) and 4675 (website: 4943).