Salat al-Tawbah (Prayer of Repentance)
Question

How is salat al-tawbah (the prayer of repentance) offered? How many rak`ahs is it? Can I offer it after ‘Asr prayer?
Praise be to Allah.The door of repentance is always open
By the mercy of Allah towards this ummah, He has opened the gate of repentance to it, and it will not cease until the soul reaches the throat (at death) or the sun rises from the west. 
By His Mercy to this ummah, He has prescribed for them an act of worship which is one of the best acts of worship, by means of which the sinner can draw close to his Lord with the hope of his repentance being accepted. This is salat al-tawbah (the prayer of repentance) and there follow some issues that have to do with this prayer. 
Is Salat al-Tawbah legislated?
The scholars unanimously agree that the prayer of repentance is prescribed in Shari’ah. Abu Dawud (1521) narrated that Abu Bakr al-Siddiq (may Allah be pleased with him) said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: “There is no one who commits a sin then purifies himself well and stands and prays two rak`ahs, then asks Allah for forgiveness, but Allah will forgive him. Then he recited this verse: ‘And those who, when they have committed Fahishah (illegal sexual intercourse) or wronged themselves with evil, remember Allah and ask forgiveness for their sins; — and none can forgive sins but Allah — and do not persist in what (wrong) they have done, while they know’ [Al ‘Imran 3:135].” (Classed as authentic by al-Albani in Sahih Abi Dawud.)
Ahmad (26998) narrated that Abu’l-Darda (may Allah be pleased with him) said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: “The one who does wudu and does it well, then stands and prays two rak`ahs or four (one of the narrators was uncertain), in which he remembers Allah and focuses well, then asks Allah for forgiveness, He will forgive him.” The editor of al-Musnad said: its chain of transmission is good. It was also quoted by al-Albani in Silsilat al-Ahadith al-Sahihah (3398). 
Salat al-Tawbah: Why?
The reason for the prayer of repentance is if a Muslim falls into sin, whether it is a major or minor sin , he has to repent from it straight away and it is recommended for him to pray these two rak`ahs. And when he repents he should do a righteous deed which is one of the best of deeds, namely prayer. So he may draw close to Allah by means of this in the hope that He may accept his repentance and forgive his sin. 
When should you offer Salat al-Tawbah?
It is mustahabb to offer this prayer when the Muslim has decided to repent from the sin that he has committed, whether this repentance comes immediately after committing the sin or later on. The sinner must hasten to repent but if he delays it, it will still be accepted, because repentance is accepted so long as one of the following impediments does not occur: 

When the soul reaches the throat (at death). The Messenger of Allah (peace and blessings of Allah be upon him) said: “Allah will accept the repentance of His slave so long as the death rattle has not yet begun.” (Classed as good by al-Albani in Sahih al-Tirmidhi, 3537)
When the sun rises from the west . The Prophet (peace and blessings of Allah be upon him) said: “Whoever repents before the sun rises from the west, Allah will accept his repentance.” (Narrated by Muslim, 2703)

Can you offer Salat al-Tawbah after `Asr prayer?
The Prayer of Repentance  is prescribed at all times including times when prayer is disallowed (such as after ‘Asr prayer), because it is one of the prayers that are done for a reason, so it is prescribed when the reason for it is present. 
Shaykh al-Islam Ibn Taymiyah said: 
“Prayers which are done for a reason, such as the prostration of recitation, greeting the mosque, the eclipse prayer, prayer immediately after purifying oneself, as mentioned in the hadith of Bilal, and istikharah prayer should not be delayed if the reason comes up at a time when prayer is disallowed, because delaying them may cause one to miss them, such as if the one who is praying istikharah may miss the thing concerning which he is seeking guidance if he delays the prayer. The same applies to the prayer of repentance. If a person commits a sin, then it is obligatory to repent straight away, and it is recommended for him to pray two rak`ahs, then repent, as it says in the hadith of Abu Bakr al-Siddiq.” (Majmu’ al-Fatawa, 23/215) 
How to offer the Prayer of Repentance 
The prayer of repentance is two rak`ahs, as it says in the hadith of Abu Bakr al-Siddiq (may Allah be pleased with him). 
It is prescribed for the one who is repenting to pray alone, because it is one of the nafl prayers that it is not prescribed to offer in congregation. After that it is prescribed to ask Allah for forgiveness, because of the hadith of Abu Bakr (may Allah be pleased with him). 
What to recite in Salat al-Tawbah?
There is no report from the Prophet (peace and blessings of Allah be upon him) to say that it is mustahabb to recite any particular surahs in these two rak`ahs, so the worshipper may recite whatever he wants. 
Always follow up a bad deed with a good deed
It is mustahabb for the penitent to strive hard in doing righteous deeds as well as offering this prayer, because Allah says (interpretation of the meaning): 
“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).” [Ta-Ha 20:82]
Among the best of righteous deeds that the penitent can do is giving charity, for charity is one of the greatest means of expiating sin. Allah says (interpretation of the meaning): 
“If you disclose your Sadaqat (almsgiving), it is good; but if you conceal them and give them to the poor, that is better for you. (Allah) will expiate you some of your sins.” [al-Baqarah 2:271]
It is proven that Ka’b ibn Malik (may Allah be pleased with him) said, when Allah accepted his repentance: O Messenger of Allah, as part of my repentance I shall give up my wealth as charity for Allah and His Messenger. The Messenger of Allah (peace and blessings of Allah be upon him) said: “Keep some of your wealth, for it is better for you.” He said: Then I shall keep my share in Khaybar. (Agreed upon)
To sum up, 

Salat al-tawbah is proven from the Prophet (peace and blessings of Allah be upon him).
It is prescribed when the Muslim repents from any sin, whether it is a major sin or a minor sin, and whether this repentance comes immediately after committing the sin or after some time has passed.
This prayer may be offered at any time, including times when prayer is disallowed.
It is mustahabb for the penitent to do some good deeds along with this prayer, such as charity etc.

May Allah send blessings and peace upon our Prophet Muhammad and upon all his family and Companions.
And Allah knows best.