If all the links are a bit intimidating, here's the short version:
Requirements for asking forgiveness:
1. Being sincere in asking forgiveness.
2. To have the intention to try and avoid that which you repent for in the future.
Forgiveness can be sought at any time. The safest is not to postpone it and make dua immediately once you realize you did something wrong. If you fear that the sin was to severe for a simple dua, then there is no harm in doing extra nafl prayer, or giving sadaqa
How, there are many dua's the shortest is to simply say "astagfurAllah"
Maybe some of those links brother Fi Sabilillah posted have better longer dua's.
1. Punishment expiates sins
1. The Prophet added: "Whoever among you fulfills his pledge will be rewarded by Allah. And whoever indulges in any one of them (except the ascription of partners to Allah) and gets the punishment in this world, that punishment will be an expiation for that sin. And if one indulges in any of them, and Allah conceals his sin, it is up to Him to forgive or punish him (in the Hereafter)." - Volume 1, Book 2, Number 17: Narrated 'Ubada bin As-Samit:
2. Sincere prayers result in forgiveness of sins
1. Allah's Apostle said, "Whoever establishes the prayers on the night of Qadr out of sincere faith and hoping to attain Allah's rewards (not to show off) then all his past sins will be forgiven." , Volume 1, Book 2, Number 34, Narrated Abu Huraira
2. Allah's Apostle said: "Whoever establishes prayers during the nights of Ramadan faithfully out of sincere faith and hoping to attain Allah's rewards (not for showing off), all his past sins will be forgiven." - , Volume 1, Book 2, Number 36, Narrated Abu Huraira
3. Fasting and sincere prayer result in forgiveness
1. Allah's Apostle said, "Whoever observes fasts during the month of Ramadan out of sincere faith, and hoping to attain Allah's rewards, then all his past sins will be forgiven." - Volume 1, Book 2, Number 37, Narrated Abu Huraira.
4. Ablutions and pure thoughts during prayer result in forgivness.
1. (the slave of 'Uthman) I saw 'Uthman bin 'Affan asking for a tumbler of water (and when it was brought) he poured water over his hands and washed them thrice and then put his right hand in the water container and rinsed his mouth, washed his nose by putting water in it and then blowing it out. then he washed his face and forearrlns [sic] up to the elbows thrice, passed his wet hands over his head and washed his feet up to the ankles thrice. Then he said, "Allah's Apostle said 'If anyone Performs ablution [washing] like that of mine and offers a two-rak'at prayer [spiritual communication with Allah] during which he does not think of anything else (not related to the present prayer) then his past sins will be forgiven.' " After performing the ablution 'Uthman said, "I am going to tell you a Hadith which I would not have told you, had I not been compelled by a certain Holy Verse (the sub narrator 'Urwa said: This verse is: "Verily, those who conceal the clear signs and the guidance which we have sent down...)" (2:159). I heard the Prophet saying, 'If a man performs ablution perfectly and then offers the compulsory congregational prayer, Allah will forgive his sins committed between that (prayer) and the (next) prayer till he offers it. Volume 1, Book 4, Number 161, Narrated Humran, See also 165
5. Prayer offered in a congregation is 25 times better than prayer offered alone and each step towards a mosque results in forgiveness of a sin.
1. The Prophet said, "The prayer offered in congregation is twenty five times more superior (in reward) to the prayer offered alone in one's house or in a business center, because if one performs ablution and does it perfectly, and then proceeds to the mosque with the sole intention of praying, then for each step which he takes towards the mosque, Allah upgrades him a degree in reward and (forgives) crosses out one sin till he enters the mosque. When he enters the mosque he is considered in prayer as long as he is waiting for the prayer and the angels keep on asking for Allah's forgiveness for him and they keep on saying: 'O Allah! Be Merciful to him, O Allah! Forgive him, as long as he keeps on sitting at his praying place and does not pass wind. (See Hadith No. 620). Volume 1, Book 8, Number 466, Narrated Abu Huraira,
6. Prayers coinciding with that of angels results in forgiveness of sins.
1. The Prophet said, "Say Amin" when the Imam says it and if the Amin of any one of you coincides with that of the angels then all his past sins will be forgiven." Ibn Shihab said, "Allah's Apostle used to Say "Amin." Volume 1, Book 12, Number 747, Narrated Abu Huraira, See also 748
7. If you recite a certain prayer and die that day, your sins will all be forgiven.
1. The Prophet said "The most superior way of asking for forgiveness from Allah is: 'Allahumma anta Rabbi la ilaha illa anta, Anta Khalaqtani wa ana abduka, wa ana 'ala ahdika wa wa'dika mastata'tu, A'udhu bika min Sharri ma sana'tu, abu'u Laka bini'matika 'alaiya, wa Abu Laka bidhanbi faghfirli innahu la yaghfiru adhdhunuba illa anta." The Prophet added. "If somebody recites it during the day with firm faith in it, and dies on the same day before the evening, he will be from the people of Paradise; and if somebody recites it at night with firm faith in it, and dies before the morning, he will be from the people of Paradise." Volume 8, Book 75, Number 318, Narrated Shaddad bin Aus, See also 335:
8. Saying a certain prayer 100 times gets the same reward as freeing 10 slaves, and forgives sins.
1. Allah's Apostle said,"Whoever says: "La ilaha illal-lah wahdahu la sharika lahu, lahu-l-mulk wa lahu-l-hamd wa huwa 'ala kulli shai'in qadir," one hundred times will get the same reward as given for manumitting ten slaves; and one hundred good deeds will be written in his accounts, and one hundred sins will be deducted from his accounts, and it (his saying) will be a shield for him from Satan on that day till night, and nobody will be able to do a better deed except the one who does more than he." Narrated Abu Huraira: Volume 8, Book 75, Number 412.
2. Allah's Apostle said, "Whoever says, 'Subhan Allah wa bihamdihi,' one hundred times a day, will be forgiven all his sins even if they were as much as the foam of the sea," Volume 8, Book 75, Number 414, Narrated Abu Huraira,