Answer: The Gemara (Shabbos 23a) relates that when R’ Zeira was a guest before he got married, he would pay his hosts in order to contribute to the mitzva of lighting the menora. Once he got married, he relied on others to light on his behalf at his home when he was away. Following this, the Shulchan Aruch (OC 677:1) writes that a guest should contribute to their host’s candles unless someone can light for them at their home. The Shulchan Aruch Harav (OC 263:9) and R’ Ovadia Yosef (Yechave Daas 6:43) write that if one is not paying one’s host for food and board, one can assume that their host is giving them the necessary oil for the menora, too.
The Mishna Berura (677:3; 7) writes that ideally the guest should light their own menora. Sefardim who follow the Shulchan Aruch (OC 671:2) and only light one menora per house would participate in their host’s lighting.
The Taz (677:2) and Mishna Berura (677:12) write that one who is eating out but sleeping at home must light at home. While the Biur Halacha (677:7) writes that one needs to be staying at one’s host for eight days in order to light there, R’ Shlomo Zalman Auerbach (Halichos Shlomo, Chanuka 14:18) and R’ Moshe Sternbuch (Teshuvos Vehanhagos 1:391) maintain that staying one night is sufficient. If one is rushing back home straight after Shabbos, they should light there. Otherwise, one should light where they have been staying.
R’ Moshe Feinstein (Igros Moshe YD 3:14:5) explains that people will understand if one is away from their home why no one has lit there. If one plans on returning at night to their home, however, people may suspect that they were home and haven’t lit. One should endeavour, therefore, to either light before one goes out or arrive back before everyone goes to bed.
In conclusion, one who goes away for Shabbos should light before Shabbos in their host’s home. If they are going home straight after Shabbos, they should light at home. Otherwise, they should light where they have been staying.