If somebody forgot to turn off the light in his bedroom on Shabbat, and keeping the light on would cause him considerable discomfort, as he would be unable to sleep properly, is it permissible for him to ask a non-Jew to turn off the light?
Turning off a light is forbidden on Shabbat only Mi’de’rabbanan (by force of Rabbinic enactment). The Torah prohibition of extinguishing on Shabbat refers only to extinguishing a flame in order to produce a coal. If one extinguishes a fire because he does not want the fire burning, but not to produce a coal, then this constitutes a "Melacha She’enah Tzericha Le’gufah" – a Melacha performed for a different purpose. According to Rabbi Shimon – and Halacha follows his opinion – performing a "Melacha She’enah Tzericha Le’gufah" on Shabbat is forbidden only Mi’de’rabbanan, and not on the level of Torah law. Moreover, when the object that is kindled is incapable of becoming a coal, such as a metal object, then extinguishing the flame is forbidden only Mi’de’rabbanan according to all opinions. The filament inside a light bulb clearly cannot be made into a coal, and thus turning off electric lights is forbidden only Mi’de’rabbanan, and not on the level of Torah prohibition.
As such, when it comes to asking a non-Jew to turn off a light, we may employ the rule of "Shebut Di’shbut Bi’mkom Saar" – it is permissible to ask a non-Jew on Shabbat to perform an act that if forbidden Mi’derabbanan, if this is necessary to avoid discomfort. Accordingly, Hacham Ovadia Yosef rules (in Hazon Ovadia, vol. 1, p. 256; listen to audio recording for precise citation) that if a person will experience considerable discomfort if the light remains on, such as if he does not feel well – even if he is not actually sick, but experiences some pain – then one may ask a non-Jew, such as a housekeeper, to turn off the light. However, Hacham Ovadia’s son, Hacham David Yosef, writes (Amira Le’akum, vol. 1, p. 201) that it is preferable in such a case to ask the non-Jew indirectly, rather than explicitly ask that he or she turn off the light.
Summary: If a light was left on in a bedroom before Shabbat, and leaving it on would cause a person discomfort, then he may ask a non-Jew to turn it off, but he should preferably ask indirectly.