Where in the home/property should the Menorah be lit- Inside the house versus outside the house?
A. The letter of the law:
The candles are to be lit outside the front door of one’s house, which opens towards the public. [This only applies if there is no courtyard in the front of one’s house, and the front door hence faces the public.]
Building: If one lives on an upper floor [or in an apartment building] and does not have a door that opens to the public, then he is to light by a window which is opened to the public [rather than light by the buildings front entrance]. [The same applies if one lives on the ground floor, but the public is unable to see the candles if one lights at the entrance of his house. See Halacha C for the full details of where to light the Menorah in the event that one is lighting inside the house, and whether one is to light by the window, as stated here, or by the doorpost of an inner room.]
Time of danger: In times of danger due to religious persecution, it suffices to simply light the Menorah on one’s table.
B. The custom:
[The previous law, mentioned in A, was the custom at the times of the Mishneh and Gemara, however, eventually, this custom changed as result of the exile, and the danger involved in lighting outside. Thus,] The custom today of all people is to always light the Menorah inside the house, even though this is not visible to the public at all. [This was the widespread Ashkenazi custom of previous times, and is followed even today amongst majority of Ashkenazim, Sephardim , and Chassidim, and so is the Chabad custom to light inside the home. However, some are accustomed today to light outside their homes, as explained in the Q&A.]
Summary of A-B:
The Mitzvah in the times of the Mishneh and Gemara was for the candles is to be lit outside the front door of one’s house, which opens towards the public. However, today in the times of exile, the widespread custom of all Jewry is to light the candles inside the house, and so is the Chabad custom.
In today’s times when there is no danger to light outside, should one preferably light the candles outside as was done originally?
Some Poskim rule that in today’s times when danger is no longer an issue, the candles are to be lit outside, as was the original institution of the Sages. Other Poskim rule that at the very least the candles should be lit by a window, facing the public. However, in truth, the Rishonim and Poskim testify that the custom is to light inside the house, by the doorpost, even though the reason of danger is no longer relevant. Accordingly, one is to continue to follow the custom to light the Menorah inside the home, by the doorpost, as was done in previous generations, even though no danger is relevant, and so is the Chabad custom, as stated above. Nonetheless, some conclude that those who light inside by the doorpost should preferably choose a doorpost which can be seen by the public.
If one is accustomed to light outside, where is he to light the candles in an apartment building?
Some Poskim question that perhaps one is to light the candles by the entrance to the building [or the entrance of his door, which leads to the stairway], and so is the custom of some. Other Poskim however rule he is to light inside his home, by his window, and so is the custom of others. Others are accustomed to light two sets of candles, one inside the home by the window, and a second by the entrance to the building.
If one is found in an area without Jews, is he nevertheless to light outside, if that is his custom?
Some Poskim rule he is to light the candles outside as usual, in order to publicize the miracle to the gentiles. Other Poskim, however, rule that he may light the candles inside, as there is no Mitzvah to publicize the miracle to the gentiles.
 Michaber 671:5; Shabbos 21b
 The reason: This is done in order to publicize the miracle. [Rashi Shabbos ibid; M”B 671:21]
 Michaber ibid; Tosafus Shabbos ibid; See Piskeiy Teshuvos 671:4 in name of Brisker Rav that this applies even today
Other opinions: Some Poskim rule one is to light the candles by the door which opens to the courtyard. [Rashi Shabbos ibid; Ran and Or Zarua, brought in Biur Halacha 671:5 “Pesach”; Kaf Hachaim 671:38] Other Poskim rule that even according to the opinion of the Michaber and Tosafus, it only applied in previous times when courtyards served as part of the home, however, today that it is only used as an entryway, one is to light by the door leading to the courtyard. Alternatively, one is to light in by the window which faces the public, or by a balcony which faces the public. [Az Nidbaru 5:39 in name of Chazon Ish; See Piskeiy Teshuvos 671:4]
 M”B 671:22
 Michaber ibid; Shabbos ibid
 The reason: He is not to light by the door downstairs, in the entrance of the building, as it is not recognizable that he lit these candles. [Beis Yosef brought in Kaf Hachaim 671:39]
 Az Nidbaru 5:39 in name of Chazon Ish; Chovos Hadar Chanukah 1 footnote 14; Piskeiy Teshuvos 671:4
 Michaber ibid; Shabbos ibid
 Rama 671:7; Tosafus Shabbos 21b; Kol Bo Chanukah p. 4; Ittur Hilchos Chanukah 10 Dibros; Or Zarua Chanukah 323; Ohel Moed Shaar Moed Katan; Birkeiy Yosef 673:2; Aruch Hashulchan 671:24; Michaber 671:5 “In times of danger light inside the house and leave it on the table, and this suffices.”; Likkutei Sichos 5:456; Sefer Haminhagim p. 70; See Shulchan Menachem 3:267-269; See Piskeiy Teshuvos 671:3; Yalkut Yosef Chanukah 671:22-23
 Likkutei Sichos 5:456; Sefer Haminhagim p. 70; See Shulchan Menachem 3:267-269; Igros Kodesh 11:414
 Az Nidbaru 10:26; See Sheilas Yaavetz 1:149 that one should light outside; Poskim in next footnote to question this matter but do not conclude to change the custom
 See Igros Moshe 4:125 that the custom is to light by the window, towards the public
 Ittur Hilchos Chanukah 10 Dibros “After it became accustomed due to danger, so is the custom”; Or Zarua Chanukah 323 “Today that there is no danger I do not know why we light inside” [proving that even after the danger, the custom was still to light inside]; Ohel Moed Shaar Moed Katan “Today we light inside by the doorpost even though there is no longer any danger”
 Aruch Hashulchan 671:24 “Today the custom is to light inside even though there is no danger”; Bnei Yissachar Mamar 4:65 [mentioned in Taamei Haminhagim 850 and Nimukei Orach Chaim ibid]; Nimukeiy Orach Chaim 671 [There he delves into this question and concludes that he does not understand why today we do not light outside even though no danger is involved, but so is the custom. He brings that his grandfather the Baal Bnei Yisaschar did not light outside despite having had a glass casing to protect the Menorah from the outside wind. He only planned to use this glass casing for the outside when Moshiach would come.]; Mishmeres Shalom 48:1; Likkutei Maharich p. 106; Mikraeiy Kodesh 16; Minchas Yitzchak 6:66; Shevet Halevi 7:84; Divrei Yehoshua 1:40; Yaskil Avdi 7:46; Moadim Uzmanim 2:140; Piskeiy Teshuvos 671:3
 The reason why today even not in times of danger we light inside: As we are afraid the wind will extinguish the candles, and the Sages did not obligate one to place the candles in a glass casing. [Aruch Hashulchan ibid; Minchas Yitzchak ibid; See Ritva Shabbos 21b] Alternatively, it is due to worry of the Menorah getting stolen. [Darkei Moshe 671:9 in name of Rabbeinu Yerucham; Imrei Noam 2:22] Alternatively, the reason is because today, during Galus, we do not have much ability to affect the outside world, and thus it is enough if we affect the inside, in our own home. [Bnei Yissachar Mamar 2:46 and 3:39 in name of Olellus Efraim, brought in Taamei Haminhagim 850; See also Mamar Osri Lagefen Torah Or p. 92 that during Galus we refine ourselves, and only in Yemos Hamashiach will we begin refining the world; See also Likkutei Sichos 3:67 in explanation of why we rule that if one is unable to afford both candles for Shabbos and Chanukah, then the Shabbos candles take precedence. The Rebbe there explains that this is because if one is unable to invest energy, and influence the spreading of peace into both his own home and also the outside world, then his own home takes precedence.]
 Aruch Hashulchan 671:24; Bnei Yissachar Mamar 4:65; Nimukeiy Orach Chaim 671; Mishmeres Shalom 48:1; Likkutei Maharich p. 106; Mikraeiy Kodesh 16; Minchas Yitzchak 6:66; Divrei Yehoshua 1:40; Yaskil Avdi 7:46; Moadim Uzmanim 2:140; Piskeiy Teshuvos 671:3
 Bnei Yissachar Mamar 4:65 in name of Rav Pinchas of Koretz; Piskeiy Teshuvos 671:3
 See Piskeiy Teshuvos 671:5
 See Chovos Hador 1 footnote 16; Moadim Uzmanim 2:143; 6:67; M”B 671:23 and Beis Yosef 671 that if one who lives upstairs has a door that opens to the courtyard, he is to light by that door; So was the custom of the Brisker Rav and Rav Kahanamen
 The reason: As the people in the building will see the candles, and it is hence considered Pirsumei Nissa.
 Az Nidbaru 5:39 based on Chazon Ish; Shevet Halevi 7:84; Piskeiy Teshuvos ibid
 The reason: As one must publicize the miracle to the outside and not to the joint owners of the building. [ibid] Likewise, it is not recognizable who lit the candles.
 Moadim Uzmanim 6:67
 Hisorerus Teshuvah 1:153
 Noheig Katzon Yosef p. 183; Lehoros Nassan 4:63; Moadim Uzmanim 2:141; See Piskeiy Teshuvos 671:6