According to the Rambam (Rabbi Moshe ben Maimon of Spain a”h) the following are the components of teshuvah.
In Hilchot Teshuvah the Rambam introduces the concept of Teshuvah Gemurah – complete repentance. He explains that a person achieves complete repentance when he encounters the precise same situation in which he had committed a sin and despite experiencing the same desire for the sin, he controls his passions and desists. Nevertheless, if a person repents only upon reaching old age, after his passions have subsided, his repentance is accepted, even though he cannot be said to have achieved “complete repentance.” In fact, even if a person repents only in the final moments before his death, his teshuvah is accepted.
Additionally, the Rambam presents the essential definition of teshuvah and the basic components that the process entails. He writes that one must abandon the sin by eliminating all thoughts of it from his mind and while promising to never repeat the act. The sinner must feel genuine remorse for having committed the wrongful act and verbally express this. At first glance, the Rambam appears to say that once teshuvah is made with sincerity, Hashem, who knows future events, can determine if a person will return to his sinful ways.
However, Rabbi Yosef Karo (a”h) in his sefer, Kesef Mishneh explains that the sinner must call Hashem as a witness to his resolve never to repeat the sin. So firm must the penitent sinner be in his resolve that he must be able to call G-d as a witness that he will never repeat the offense.
The Rambam emphasizes the importance of verbal confession and the internal resolve to change. If a person verbally confesses his wrongdoing without a resolve to change his ways, it is compared to a person who immerses in a mikveh while holding the carcass of a rodent in his hand. As long as he holds the Sheretz in his hand, (the source of his spiritual impurity), he can never achieve true purity no matter how often he immerses in the mikveh. Regardless of how many times a person confesses his sins, he does not achieve teshuvah without commitment to change. It is also not enough for a sinner to resolve never to repeat the sin without verbally confessing.