To sum up: 
1-    This prayer is proven from the Prophet (peace and blessings of Allaah be upon him).
2-    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.
3-    This prayer may be offered at any time, including times when prayer is disallowed.
4-    It is mustahabb for the penitent to do some good deeds along with this prayer, such as charity etc.