WHERE TO LIGHT NER CHANUKAH [Ner Chanukah :place]
Gemara
21b (Beraisa): The Mitzvah is to leave Ner Chanukah outside Pesach Beiso (the door of one's house). One who lives in an Aliyah (upper story) should leave it near a window near Reshus ha'Rabim.
At a time of danger, it suffices to leave it on one's table.
22b: Rava taught that if one lit inside and took it outside, he was not Yotzei.
We understand this if the Mitzvah is Hadlakah (lighting). Hanachah (placing the Ner down) in must be in the place of Hadlakah;
But if the Mitzvah is Hanachah, why wasn't he Yotzei?!
Rejection: He was not Yotzei because it looks like he needs the light.
23a (Rav Huna): If a house has two openings to a Chatzer, Ner Chanukah must be placed in both.
(Rava): This is only if the openings are on different sides of the house, but not if they are on the same side.
Suggestion: We require two Neros due to suspicion.
Question: Even if both openings are on opposite sides, they will not suspect! (People of this city know that the house is not split They will see that the Ba'al ha'Bayis lit on the other side.)
Answer: Perhaps some will pass by only on this side, and suspect that the Ba'al ha'Bayis did not light on either side.
23b (R. Yitzchak bar Redifah): If a Ner has two openings (for wicks), two people can fulfill the Mitzvah through it.
Rishonim
Ran (9b DH v'Im): At a time of danger, when they decreed against Mitzvos, one puts the Ner Chanukah on his table (even though) one who sees thinks that the Ner is not for the Mitzvah, rather, it is his lamp (for his use).
Ran (DH Amar Rava): It seems that Rava agrees that one may not use Ner Chanukah. If so, obviously one needs another Ner! He teaches that even though at a time of danger one leaves it on his table, and he is forced to benefit from it, still he needs another Ner for a sign (that the Ner is for the Mitzvah).
Tosfos (21b DH Mitzvah): The Beraisa discusses when there is no Chatzer. The house is next to Reshus ha'Rabim. If there is a Chatzer in front of the house, the Mitzvah is to leave it at Pesach (the opening of) ha'Chatzer. We say below that if a house has two openings to a Chatzer, Ner Chanukah must be placed in both. Also, if a Ner has two openings (for wicks), two people can fulfill the Mitzvah through it. 'Two people' connotes [that they live in] two houses. If one leaves Ner Chanukah at the opening of the house, for one person it is on the right, and for the other it is on the left! (One must put Ner Chanukah on the left.) This is not difficult if they leave Ner Chanukah in the Chatzer.
Poskim
Shulchan Aruch (OC 671:5): The Mitzvah is to leave Ner Chanukah at the opening next to Reshus ha'Rabim, on the outside. If the house is open to Reshus ha'Rabim, he leaves it in the opening. If there is a Chatzer in front of the house, he leaves it at Pesach ha'Chatzer.
Beis Yosef (DH Aval): Rashi explains that one leaves it outside to publicize the miracle. It is not in Reshus ha'Rabim, rather, in the Chatzer. Their houses were open to the Chatzer.
Gra: Tosfos brought a proof from (the law of) Sa'if 3 (a Ner with two openings). Rashi defended himself. Tosfos brought another proof from Sa'if 8 (a Chatzer with two openings).
Damesek Eliezer: Rashi explains that a Ner with two openings counts for two, according to Mehadrin (everyone in the house lights). He also defended himself from Sa'if 8. The house has two openings to the Chatzer!
Bi'ur Halachah (DH Pesach): The Ran and Or Zaru'a hold like Rashi, that if the house opens to a Chatzer, he leaves it at Pesach Beiso.
Shulchan Aruch (ibid.): If he lives in an Aliyah that has no opening to Reshus ha'Rabim, he leaves it near a window near Reshus ha'Rabim.
Beis Yosef (DH Aval): If he lives in an Aliyah and he has no place in the Chatzer to leave it, he leaves it inside opposite a window near Reshus ha'Rabim. The Tur wrote like Tosfos, that the Mitzvah is to leave it at Pesach Beiso, outside. Therefore, he needed to explain that "if he lives in an Aliyah, he leaves it near a window near Reshus ha'Rabim" refers to one who has no opening to Reshus ha'Rabim. If the opening to the Aliyah was open to Reshus ha'Rabim, he would leave it at the opening. If it was open to the Chatzer, he would leave it at Pesach ha'Chatzer, which is open to Reshus ha'Rabim. Here we discuss an Aliyah open to the house. If he leaves it at Pesach Beiso or at Pesach ha'Chatzer, it is not recognized that it is due to the Aliyah. Therefore, he leaves it in the window near Reshus ha'Rabim.
Kaf ha'Chayim (39, citing Chayei Adam 124:16): For us, there is a bigger Heker to leave it in the window than in the opening. In the window it is visible to people in Reshus ha'Rabim. If the window is more than 20 Amos above Reshus ha'Rabim, it is better to put it in the opening.
Mishnah Berurah (23): The Shulchan Aruch discusses when it does not even have an opening to the Chatzer. Rather, it is open to the house.
Shulchan Aruch (ibid.): At a time of danger when he may not fulfill the Mitzvah, it suffices to leave it on his table.
Magen Avraham (5): The Ran says even though at a time of danger one leaves it on his table, and he is forced to benefit from it, still he needs another Ner for a sign. This is the source for the custom to light a Shamash.
Bi'ur Halachah (DH v'Tzarich): Rashi says that the extra Ner is for a Heker. I.e. even if he does not want to use the Neros at all, he needs another Ner so he could use them. Through this it is recognized that the first Ner is for the Mitzvah. If not, since it is on the table, people will say that it is for his needs. This is only if it is on his table. If it is near the opening, he does not need another Ner, even if he stands there, since he does not need to use the light. However, the universal custom, and that of our Rebbe'im, is to have an extra Ner whenever lighting in the house, even if he does not need the light, lest people say that he needs it. The Me'iri says so, and the Pri Megadim brings like this from Teshuvas ha'Rema.
Kaf ha'Chayim (42): Halichos Olam says that the extra Ner may not be from the oils or wicks that Chachamim forbade, for when it extinguishes, he will comes to use the Neros Chanukah.
Shulchan Aruch (675:1): One must light Ner Chanukah where he will leave it. If he lit indoors and placed it outdoors, he was not Yotzei, for one who sees it says "he lit it for his needs."
Bach (7): According to the opinion that Hanachah is the Mitzvah, the Gemara says that one must light in its place lest people say "he lit it for his needs." We concluded that Hadlakah is the Mitzvah. If so, we do not need this reason (lest people say...)! Why did the Rif, Rambam, Rosh and Tur bring it? It seems that they hold that we conclude that even if Hadlakah is the Mitzvah, one need not light where he will leave it, if not lest people say... Alternatively, even for us, who light indoors, if he took it outside he was not Yotzei, due to what others will say. The first reason is primary.
Magen Avraham (3): The Bach answered that even for us, if he took it outside he was not Yotzei, due to what others will say.
Rebuttal (Gra DH sheha'Ro'eh): If so, it should have said oppositely, that if he lit outside and took it inside, he was not Yotzei! It seems that in the days of the Tur, they lit at Pesach Beiso. Even so, if he lit inside he was Yotzei, for in any case they did not do like the Gemara says.
Damesek Eliezer: I.e. according to the Bach, why did the Tur say 'one must light where he will leave it. If he lit inside and took it out...' He should illustrate oppositely, if he lit outside and took it to where it will stay (inside)! Rather, the Tur holds that one lights at Pesach Beiso. If one lit in the house and took it out, he was not Yotzei. We cannot say that this is because Hadlakah is the Mitzvah, for nowadays inside is the proper place, since in any case we do not light like the Gemara says, i.e. in the Chatzer or Reshus ha'Rabim! Rather, it is due to what people will say. This is called "not in its place", for we light at Pesach Beiso.
Mishnah Berurah (5): In the days of the Gemara, one needed to light where he will leave it, at Pesach Beiso to publicize the miracle. Nowadays we are lenient to light inside, but still he must light where he will leave it, lest people say that it is for his needs. Likewise, one who lights outside and brings it inside was not Yotzei.