The Shulhan Aruch (Orah Haim 276) rules that one may not benefit from a light that was turned on by a non-Jew specifically for a Jew on Shabbat. It goes without saying that it is forbidden to ask a non-Jew to turn on a light on Shabbat. But even if the non-Jew decided on his own to turn on a light for a Jew – such as if he saw the Jew sitting in a dark room – the Jew may not then derive benefit from that light.
The Rama (Rav Moshe Isserles of Cracow, 1525-1572) writes that this Halacha applies even if the non-Jew was hired by the Jew before Shabbat. One might have argued that under such an arrangement, the non-Jew is, essentially, turning the light on for himself – so he can earn his wages – and not really for the Jew. The Rama, however, did not accept this argument, and maintained that since the non-Jew is turning the light on to help the Jew, it is forbidden for the Jew to then derive benefit from the light.
A number of Poskim argued that the Shulhan Arch did not accept this ruling. Elsewhere (254), the Shulhan Aruch writes that if one brought his garment to a non-Jew at some point during the week to be cleaned, and the non-Jew decided to clean it and bring it to the Jew on Shabbat, the Jew may wear it that same day. The reason is that the non-Jew is doing the job for his own purposes, to get paid, and not to serve the Jew. By the same token, a number of Poskim contend that the Shulhan Aruch would allow one to benefit from a light turned on by a non-Jew on Shabbat if the non-Jew is hired by the Jew. This was the view of several Halachic authorities, including the Minhat Kohen, as well as the Ben Ish Hai (Rav Yosef Haim of Baghdad, 1833-1909), in his Rab Pe’alim (2:43). This is also the view of the Eliyahu Rabba (based on the position of the Ran, in Masechet Shabbat). The Ben Ish Hai applied this rationale to allow a congregation in Mumbai to hire a non-Jew on a monthly salary to turn on lights for them on Shabbat. Since the non-Jew was essentially turning on the lights for himself, to earn his wages, the Ben Ish Hai felt this was permissible. Hacham Ovadia Yosef, in his Hazon Ovadia (vol. 1, p. 158), accepted this reading of the Shulhan Aruch.
By contrast, the Magen Abraham (Rav Abraham Gombiner, Poland, 1637-1682) distinguished between the two cases. He notes that when a non-Jew cleans a garment and brings it to the Jew, the Jew does not derive benefit from the garment immediately, and it is therefore permissible, since the non-Jew is essentially performing the task for his own interests. But when a non-Jew turns on a light, the Jew derives benefit immediately, and this is therefore forbidden. Indeed, many Halachic authorities maintained that one may not derive benefit from a light turned on by a non-Jew for a Jew on Shabbat even if the non-Jew is being paid. The Hida (Rav Haim Yosef David Azulai, 1724-1806), for example, in Birkeh Yosef (Hilchot Yom Tob), maintained that the Shulhan Aruch would not allow one to benefit from light turned on by a non-Jewish worker. Moreover, even the Eliyahu Rabba, who rules leniently in this regard, allows benefiting from the light only if this occurred in the non-Jew’s home. If the non-Jew turned on a light in the Jew’s home, the Jew may not benefit from the light, due to the concern of "Mar’it Ha’ayin" – people may not be aware that the non-Jew is working for the Jew, and may thus assume that the Jew had asked the non-Jew to turn on the light for him. Therefore, even according to the Eliyahu Rabba, it would be forbidden to benefit from a light turned on by one’s non-Jewish housekeeper on Shabbat.
As for the practical Halacha, Rav Shalom Mesas (Morocco-Jerusalem, 1909-2003), as well as Hacham David Yosef, ruled that one should follow the stringent view and not derive benefit from light turned on by a non-Jew for a Jew, even if the non-Jew is hired to work for the Jew. This is especially so with regard to housekeepers, which are not necessarily paid to turn on lights; they are paid to do general housework.
Many people mistakenly assume that employing a non-Jewish housekeeper avoids all such problems, and any Melacha performed by the housekeeper is permissible. This is incorrect, and, as we have seen, even if the housekeeper turns the light on for the Jew without having been asked, the Jew may not benefit from the light. Certainly, it is forbidden to ask a housekeeper to turn on the light.
Rav Moshe Halevi (Israel, 1961-2001), in his Menuhat Ahaba, rules that one may be lenient in this regard "Le’sorech Gadol" – in situations of dire need. And thus, for example, if an elderly person needs to use the elevator in his building, he may make an arrangement with the non-Jewish doorman that he will be paid to bring the man on the elevator and press the button when he needs. Otherwise, however, one may not benefit from Melacha performed by a non-Jew specifically for a Jew on Shabbat, even if the non-Jew is being paid.
Summary: If a non-Jew turns on a light on Shabbat specifically for a Jew, even without being asked to do so, the Jew may not benefit from that light. According to some opinions, the Jew may benefit from the light if the non-Jew is hired by the Jew, such as in the case of a housekeeper. The accepted Halacha, however, does not follow this opinion, except under extenuating circumstances, such as if one needs to ride an elevator on Shabbat and pays a non-Jew before Shabbat to press the buttons for him.