assalam 'alaikum warahmatullahi wabarakatuh
My respected brother and sister has answered very beautifully to your question. I am here just to add something which will be beneficial inshaAllah.
The simplest form of Astaghfaar is saying "Astaghfirullah!". The best form of Astaghfaar is mentioned in the below Hadith of Prophet (sallallahu 'alaihi wasallam).
On the authority of Shaddad ibn Aws, may Allah be pleased with him, the Prophet, Sallallahu Alayhi Wa Aalihi Wa Sallam, said,
“The chief of prayers for forgiveness is:
0 Allah! You are my Cherisher. There is no deity except You. You have created me and I am Your servant and as far as possible, I abide by my solemn promise and covenant (which I made to You). I seek Your protection against the consequences of my wrongdoings. I fully acknowledge the grace You have bestowed upon me and I confess my faults. So pardon me my sins as none besides You can pardon sins.
The Prophet (sallallahu 'alaihi wasallam) 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.”
Sahih Al-Bukhari, Volume 8, Book 75, Number 318
wassalam 'alaikum warahmatullahi wabarakatuh