Q. Does an avel during shiva go to shul on Erev Rosh Hashana? If he does and that is the last day of shiva, does he return home or he is lifted from shiva at the shul?
A. Remah (O.H. 581: 1) rules that an ovel is prohibited from leaving home to go to shul and recite selichos, excluding Erev Rosh Hashana when many selichos are said. Mishna Berura (ibid. 8) quotes Magen Avrohom that the same applies to Erev Yom Kippur in locations where they also recite many more selichos.
Horav Shlomo Miller's Shlit'a opinion is that even if the ovel can marshal a minyan for selichos at home, but the davening in shul is more spiritually meaningful and is done with significant more kavanah and many more selichos are recited on these most important occasion, he is allowed to attend shul.
The Rov added that after davening, the ovel returns home and ends shiva there.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit'a