The Law of the Guest
The Gemara, Shabbat 23a, quotes R. Sheshet, who states that if someone is a guest at another person's home he should contribute a peruta (a very small amount of money) towards the purchase of the oil necessary to fuel the Chanukah candles. The Gemara then quotes R. Zeira, who states that when he was a guest he used to contribute a peruta. After he got married he no longer contributed a peruta because his wife lit the Chanukah lights at home, thus fulfilling his obligation.
The implication of the Gemara is that if one is traveling and his wife is lighting at home, he is not required to light Chanukah candles. If his wife is not lighting at home (either because she is traveling with him or because he is not married), he is required to contribute a peruta to purchase part of the oil that his host will use.
Although the law of the guest is clear, there are three factors that affect the application of this law on a practical level. First, the Gemara, Shabbat 23a, states that one who sees the lights of others recites the beracha of she'asa nissim la'avoteinu. Ran, Shabbat 10a, s.v. Amar Rav Chiya, rules that this beracha is only recited if someone has no way of fulfilling the mitzvah. If one fulfills the mitzvah, even if it is fulfilled through one's wife lighting at home or by contributing a peruta, one does not recite the beracha. However, Mordechai, Shabbat no. 267, claims that one who is a guest and is not lighting on his own should recite the beracha upon seeing someone else’s light.
Second, the Gemara, Shabbat 23a, states that if one's home has multiple entrances, he must light in each of the entrances in order to avoid suspicion (chashad) that he does not light Chanukah lights. Rif, Shabbat 10a, applies this concept to a guest and notes that if a guest has a private entrance to the house, he must light at that entrance in order to avoid chashad.
Regarding the house with multiple entrances, Rama, Orach Chaim 671:8, rules that nowadays, when everyone lights indoors, there is no need to light in all entrances of the house. However, regarding the guest, one can take the viewpoint that there is no concern at all of chashad. Alternatively, one can take the viewpoint that even the guest has no private entrance to the house, there is a concern of chashad since the other members of the house don't necessarily know that someone else is lighting for the guest elsewhere. Mishna Berurah, Biur Halacha 671:1, s.v. Petach, asserts that logically, he would follow the former approach. However, he notes that Maharil, Teshuvot Maharil no. 145, explicitly presents the latter approach.
Third, Tosafot, Shabbat 21b, s.v. VeHaMehadrin, state that one cannot fulfill the mehadrin (preferable) aspect of lighting if one places more than one set of lights in the doorway because it won't be recognizable that there are multiple sets of lights. Rama, Orach Chaim 671:2 (see Darkei Moshe 671:1) rules that nowadays, when everyone lights indoors, there is no concern for multiple lights because the different sets of lights can be separated.
Based on these three factors, Mishna Berurah 677:7 (based on the comments of Maharil, op. cit.), rules that one who is a guest should light on his own, regardless of whether his wife is lighting for him. By lighting on his own, he can avoid the issue of whether he should recite the beracha of she'asa nissim la'avoteinu. He may now certainly recite the beracha because he is fulfilling the mitzvah himself. By lighting himself he also mitigates the concern for chashad. Furthermore, since nowadays, it is justifiable for the guest to light himself, and it will not affect the lights of everyone else, there is a third option for a guest other than contributing a peruta or relying on one's wife.
While most Acharonim do allow a guest to light in someone else's house and recite a beracha, Mishna Berurah 677:16, presents a minority opinion among the Acharonim that if one's wife already lit at home, he should not recite a beracha upon lighting. Mishna Berurah rules that if one finds himself in this situation, he should listen to someone else recite the berachot and then light the Chanukah lights.
According to Mishna Berurah a guest may certainly recite a beracha if his wife is not lighting at home. Nevertheless, Rav Yosef D. Soloveitchik (cited in B'Ikvei HaTzon ch. 20, note 2) was of the opinion that a guest may never recite a beracha because the mitzvah of lighting Chanukah lights was only instituted in one's own home.
What Constitutes a Guest?
Given that a guest may light, one must question what constitutes a guest. May one light in someone else's home if he is only visiting for a few hours? Rashba, Teshuvot HaRashba 1:542, rules that one may only employ the rule of the guest in a situation where the guest has no option to light in his own home. Ostensibly, this same ruling should apply to someone who is not employing the rule of the guest by contributing a peruta, but would like to consider himself part of the household for the purpose of lighting there. If this person has an option of lighting at home, he should do so. If not, he may light at the home of his host.
For this reason, Magen Avraham 677:7, and Taz, Orach Chaim 677:2, rule that if one is eating at someone else's home and he plans to sleep in his own home, he may not light at the home of his host. Nevertheless, the comments of Taz imply that if one is sleeping at his host's home, he may light there. However, P'ri Chadash, Orach Chaim 677:1, discusses a case of a family who spends the entire Chanukah at the home of another family while only returning to their own home for an occasional meal. P'ri Chadash rules that since they are sleeping at the host's house for the entire Chanukah, they may light at the home of the host. P'ri Chadash's comments are quoted by Mishna Berurah, Biur Halacha 677:1 s.v. L'Atzmo.
Implicit in P'ri Chadash's ruling is that one may only light at the home of the host if one resides there for the entire Chanukah. If one only resides there for one night of Chanukah, one may not light at the home of the host. However, R. Yeshaya. Y. Bloi, Chovat HaDar, Ner Chanukah ch. 1 note 58, claims that P'ri Chadash does not necessarily insist on one staying at the host for all eight days in order to light there. He is merely giving an example of a common situation where a family spends Chanukah at the home of another family. R. Bloi rules that since Taz implies that sleeping at the host for one night is sufficient and it is possible that P'ri Chadash is lenient, one may light at a place where one stays for one night.
Rav Moshe Shternbuch, Moadim Uzmanim, Orach Chaim 1:391, also rules that it is not necessary to stay for the entire Chanukah in order to light at the home of the host. The reason why P'ri Chadash mentions eight days is because in that situation the guest was continuously returning to his home, albeit only occasionally, and on a temporary basis. If a person is not going to return home at all, R. Shternbuch contends that it is sufficient that the guest remains for a twenty-four hour period. [See also, B'Ikvei HaTzon op. cit.]
R. Shternbuch then notes that if someone is a guest for Shabbat and is planning on returning home after Shabbat, he may light at the home of his host after Shabbat, even though he has the ability to light in his own home later that night. However, R. Shternbuch rules that if one is able to light at a time when there are still people traversing the streets around one's home, it is preferable to light at home.