While the mitzva to light the Menora only applies at home, the Shulchan Aruch (OC 671:7) writes that the minhag is to also light in shul. The Rivash (Shut Harivash 111) writes that although one doesn’t fulfil the mitzva by lighting in shul, one should still recite the berachos when lighting, comparing it to the minhag of reciting hallel on Rosh Chodesh (see Shut Chacham Tzvi 88; Yabia Omer 7 OC 57:4). He explains that this minhag developed when it became forbidden to light the Menora outdoors. Lighting in shul ensured that the miracles of Chanuka were publicly commemorated (pirsumei nisa).
While the Rema (OC 671:7) follows the Rivash that one can’t fulfil one’s obligation to light through the shul’s menora, the Kolbo (44) writes that one reason for this minhag is on behalf of those who don’t light at home. The Beis Yosef (OC 671:7) writes similarly that visitors can fulfil their obligation through the shul’s Menora. The Shibolei Haleket (185) writes that as visitors no longer sleep over in the shul¸ this reason no longer applies. Other reasons suggested are to educate others how to recite the berachos (Beis Yosef) and to commemorate the Menora in the beis hamikdash (Kolbo).
The Mishna Berura (671:46) writes that the ideal time to light in shul is before maariv so many people can see it. After maariv people want to rush home to light their own.
While there are different opinions as to where the Menora should be placed (see Darkei Moshe OC 671:6), most follow the Shulchan Aruch (OC 671:7) who writes that it should be placed on the right side of the aron hakodesh as in the beis hamikdash it was placed on the southern wall (Mishna Berura 671:40). The one lighting should stand to the south of the Menora.
The Mishna Berura (671:45) writes that the one who lights in shul must light again at home. While he repeats the berachos, he should only recite shecheyanu if he is lighting on behalf of others, too (See Igros Moshe OC 1:190).
One who had already lit at home (e.g. on Friday) may repeat all of the berachos including shecheyanu.
R’ Ephraim Greenblatt (Rivevos Ephraim 3:453; 5:432; 8:273:1) writes that one doesn’t need to leave the shul menora alight for half an hour, and one may extinguish it for safety reasons, etc. (See Teshuvos Vehanhagos 4:171).
The Pri Megadim (Eishel Avraham 670:2) writes that the minhag is to relight the menora in the morning to burn during shacharis though no beracha is recited (See Yalkut Yosef, 671:17).
Ideally one should wait until there is a minyan present to light (See Shaar Tzion 671:54; Rivevos Ephraim 8:265:6). R’ Ovadia Yosef (Yabia Omer 10 OC 55:37) writes that as women were included in the miracle of Chanuka, they count towards the minyan.