1- It is a commendable act to thank Allah when something good befalls you. You can express yourgratitude to Allah by offering sujud ash-shukr(prostration of thankfulness).
2- Such sajdah (prostration) requires the same conditions required by Salah (ritual Prayers), according to the majority of jurists.
The majority of Muslim jurists agree on the permissibility of offering sujud ash-shukr to express gratefulness to Allah as He showers His bounties explicitly and implicitly on man. Such type of sujud is an aspect of thanksgiving. It is one prostration only.
Abu Bakrah (may Allah be pleased with him) said that whenever the Prophet (peace be upon him) received something that pleased him or some glad news, he would prostrate in showing gratefulness to Allah. (Abu Dawud, Ibn Majah and At-Tirmidhi)
Al-Baihaqi also reported that the Prophet (peace be upon him) prostrated to Allah when he was informed that the Tribe of Hamadan had embraced Islam.
In addition, Ahmad and Al-Hakim reported that the Prophet (peace be upon him) prostrated in gratitude to Allah when Jibril (the Angel Gabriel) told him that Allah Almighty sends blessings to anyone who sends blessings to the Prophet (peace be upon him).
Sujud ash-shukr is bound by the same requirements as the prostration in Prayer, such as taharah (purity), facing the qiblah (the direction of the Ka`bah), wearing the proper Islamic dress and so on, as the majority of jurists agree.
The rituals of sujud ash-shukr are to have the prior intention, to say “Allahu Akbar” at the beginning, to prostrate once, and finally to end the prayer by saying “As-salamu `alaykum wa Rahmatu Allah.”
Scholars of the Maliki School of Fiqh are of the opinion that there is nothing called sujud ash-shukr. Rather it is commendable to offer two rak`ahs of Prayer whenever something good befalls one or some evil is warded off.
Some scholars, on the other hand, opine that sujud ash-shukr does not require ritual acts implied in other Prayers. This point of view is reported in Fath Al-`Allam as the most correct view.
“There is nothing in the Hadith to prove that ablution and purity of the clothes and place are required for sujud ash-shukr, and that is the opinion of Imam Yahya and Abu Talib. And these Hadiths are silent on whether takbir (saying “Allahu Akbar”) is made with the prostration.”
Others say that one should make takbir, but one is not to make the prostration of thankfulness during the Prayer (Salah) as it is not part of the Prayer.