The Sanskrit word for penance is "Tapasya".
Here is a short and simple description of what Tapasya actually is from a minor Upanishad called the Niralamba Upanishad (which is linked with the Shukla Yajurveda and is one of the 108 Upanishads as per Muktika)
This Upanishad begins with lots of questions and then it itself goes on answering them.
Few questions posed are like:
What is Jnana ? What is Ajnana ? What is Sukha ? What is Duhkha ? What
is Swarga ? What is Naraka ? What is Bandha ? What is Moksha ? Who is
Upasya ? Who is Yidwan ? Who is Mudha ? What is Asura ? What is Tapas
The answer for "What is Tapas?" is given later in it as follows:
- What is Tapas?
Tapas is the act of burning through the fire of direct cognition of
the knowledge that Brahman is the truth and the universe, a myth the
seed of the deep-rooted desire to attain the powers of Brahma, etc.
And, Tapasya is nothing but "the act of performing Tapas".
Now, since Tapasya always involve subjugation of the senses, and since the senses are nothing but respective Devas (deities), hence Tapas is also identified with the Asuras (demons, who by nature are always opposing the Devas) in the same Upanishad.
- What is Asura [the demoniacal] ?
It is the Tapas [austerity] practised by one inflicting trouble on the
Atma within through Japa [or inaudible muttering of Mantras],
abstinence from food, Agnihotra [the performance of the worship of
fire]., etc., attended with cruel desire, hatred, pain, hypocrisy and
the rest for the purpose of acquiring the powers of Vishnu, Brahma,
Rudra, Indra and others.
In the Vedas, Tapas is identified with the "fire of the energy of consciousness" from which both Satyam (Truth) and Ritam (Law of working of that truth) were born.
Rtam cha satyam chAbhidhdAt (1), tapaso adhyajAyata (2)
Truth was born and the Law of Truth (1), From the kindled fire of
Energy of Consciousness.(2)
Rig Veda 10.190.1
In other scriptures, penance or austerities are mentioned as effective measures for sin-cleansing and purification.
Manu smriti 11.44. A man who omits a prescribed act, or performs a
blamable act, or cleaves to sensual enjoyments, must perform a
Manu smriti 11.53. Penances, therefore, must always be performed for
the sake of purification, because those whose sins have not been
expiated, are born (again) with disgraceful marks.
Penance can be internal and external both. External penances always involve fasting and abstaining from other sensual indulgences. Like the Vratas called Chandrayana etc that involve prolonged fasting (or regulated eating).
One becomes freed of all the sins, if one performs the above five
Chândrâyanas. By the performance of the Tapta Krichchhra, all sins are
burnt off in an instant. By the performance of the three Chândrâyanas
the people get purified and go to the Brahma Loka. By doing eight
Chândrâyanas, one sees face to face one’s Devatâ, ready to grant
boons. With ten Chândrâyanas, one gets the knowledge of the Vedas and
one acquires all what one wants.
Devi Bhagavata Purana Book 11, Chapter 23