The Shulhan Aruch (Orah Haim 229:2; listen to audio recording for precise citation) codifies the Halacha of "Birkat Ha’hama" – the special Beracha recited upon seeing the sun in the original position in which it was placed in the heavens at the time of creation. This phenomenon occurs once every twenty-eight years, on a Wednesday during the month of Nissan. It will happen this year (5769/2009) on Wednesday, Erev Pesah. Upon viewing the sun that day, one recites the Beracha of "Ose Ma’ase Bereshit."
Preferably, one should recite the Beracha after he views the sun for the first time that day. Nevertheless, if one did not recite the Beracha after viewing the sun for the first time, he may recite it after viewing the sun again. Furthermore, in light of the principle of "Zerizin Makdimin Le’misvot" (one should perform Misvot with zeal and alacrity), it is proper to recite the Beracha early in the morning, immediately at sunrise, when the sun first becomes visible. This is the ruling of the Hida (Rav Haim Yosef David Azulai, 1724-1806) and the Hesed La’alafim (Rav Eliezer Papo, 1770-1828). However, those who generally make a point of praying Shaharit immediately at sunrise should first pray Shaharit and then go outside to recite Birkat Ha’hama immediately after praying. The value of praying Shaharit right at sunrise supersedes the value of reciting Birkat Ha’hama at sunrise, and so it is preferable to first pray Shaharit before reciting Birkat Ha’hama.
Indeed, it has become customary to recite Shaharit on the morning of Birkat Ha’hama at sunrise, and to then go outside to recite the Beracha immediately after Shaharit. This practice is recorded by Rav Yaakov Haim Sofer (1870-1939) in his Kaf Ha’haim (229:13), and codified by Hacham Ovadia Yosef in his Yehave Da’at (vol. 4).
It is customary to recite a number of relevant chapters of Tehillim – specifically chapters 29 and 148 – before reciting Birkat Ha’hama, and to recite the verses describing the creation of the luminaries (Bereshit 1:14-19). Additionally, there is a custom to recite the "Kel Adon" hymn which we normally recite on Shabbat morning. This custom is recorded in the Kaf Ha’haim and Ben Ish Hai.
A number of authorities (including the Hatam Sofer and Mishna Berura) also mention the practice of reciting Alenu Le’shabe’ah after Birkat Ha’hama. Hacham Ovadia Yosef, in his work Yehave Da’at (vol. 4, 18:12), warns that those who recite Alenu must ensure not to bow facing the sun as they recite "Va’anahnu Kor’im." They must turn away from the sun while bowing so as not to give the impression that they worship the sun, Heaven forbid.
Summary: Birkat Ha’hama – the Beracha of "Ose Ma’ase Bereshit" – is recited once every twenty-eight years, when the sun returns to the position in the sky in which it was placed at the time of creation. This will occur this year (5769/2009) on Erev Pesah. It is customary for communities to pray Shaharit at sunrise and then go outside immediately after Shaharit to recite this Beracha.