Halacha requires lighting candles before Shabbat in order to ensure the presence of light in the home, which adds to the enjoyment and sense of peace and serenity that Shabbat requires. Customarily, of course, it is the woman who lights the Shabbat candles on behalf of everyone in the household.
The Halachic authorities addressed the question of whether a woman may recite the Beracha over the Shabbat candles if she lights them in a room that already has illumination, as often happens nowadays. Generally speaking, the Shabbat candles are lit in or near the dining room that is usually fully illuminated through a chandelier or other form of electric lighting. The candles do not appear to add any significant amount of life in comparison with the electric illumination, and it thus seems questionable as to whether the candle lighting can indeed be considered to fulfill the Misva. If the candles do not fulfill the Misva, then we must conclude that one may not recite the Beracha before lighting them.
This question appears to hinge on a debate cited in the Shulhan Aruch (Orah Haim 263:8), concerning a case of several families who eat together. The Shulhan Aruch first cites the view of the Or Zarua (Rabbi Yishak of Vienna, late 12th-early 13th century), who held that the woman in each family should light and recite a Beracha. According to the Or Zarua, each candle or set of candles enhances the Shabbat by contributing a small amount of light, and therefore each lighting fulfills a Misva. Hence, each person who lights recites a Beracha, despite the fact that many other candles have already been lit. However, the Shulhan Aruch then proceeds to cite those who question thus opinion. The Shulhan Aruch concludes that one should preferably avoid this situation of uncertainty, and only the first person who lights in the room should recite the Beracha.
Seemingly, this should also apply to the question mentioned above, regarding lighting the Shabbat candles in one’s illuminated dining room. Here, too, it appears, one should preferably not recite a Beracha if light already exists in the room. Indeed, Rabbi Eliyahu Mani (Baghdad-Israel, 1824-1899), in his work Zichronot Eliyahu, ruled that a woman should extinguish the gas burners in the room before lighting the Shabbat candles. While reciting the Beracha over the Shabbat candles, she should have in mind for the Beracha to apply also to the gas burner, which she should then kindle after lighting the Shabbat candles.
Likewise, Hacham Ovadia Yosef, in his Hazon Ovadia (p. 215; listen to audio recording for precise citation), rules that a woman should turn off the lights in the room before kindling the Shabbat lights. She should have in mind while reciting the Beracha that she does not accept Shabbat, and that the Beracha should apply also to the electric lights in the room.
A problem, however, arises in a case where Yom Tob falls on Friday. In such a case, a person lights the Shabbat candles on Yom Tob, and therefore he obviously cannot extinguish or turn on lights. How, then, can one observe this Halacha? (The work "Shemirat Shabbat Ke’hilchata," in chapter 28, cites this question in the name of Rabbi Shlomo Zalman Auerbach.)
Two solutions have been proposed. First, one can set a timer to turn the lights in the room off before the time for candle lighting, and turn them back on after candle lighting. In this way, one ensures that the room will not have any other source of illumination at the time of the Shabbat candle lighting. Alternatively, one can light the Shabbat candles in a different room, where there are no electric lights.
It should be noted that Hacham Ovadia codifies this Halacha with the word "Ra’ui" – "It is proper" – indicating that this is the preferred practice, but not a strict requirement. Hence, if a woman lit the Shabbat candles while other lights in the room were turned on, she has nevertheless fulfilled her obligation and has not recited a Beracha Le’batala ("wasted" Beracha). The reason, as Hacham Ovadia explains, is that some authorities drew a distinction between the case of different families lighting in the same room, and the situation of lighting in one’s own illuminated dining room. In the case of families lighting together, all the candles were lit for the purpose of fulfilling the obligation of Shabbat candles. As such, once a Shabbat candle has been lit, the subsequent Shabbat candles do not enhance the illumination in the room. In one’s own dining room, however, the electric lighting was not turned on for the purpose of fulfilling the Misva of Shabbat candles. Therefore, the Shabbat candles, which are lit for this purpose, are the only lights through which this obligation is fulfilled, and thus naturally one may recite a Beracha over these candles.
Hence, although it is certainly preferable to extinguish the electric lighting, as discussed, one who does not do so cannot be said to have acted improperly.
Summary: It is proper for a woman before lighting the Shabbat candles to turn off all the lights in the room. When reciting the Beracha, she should have in mind not to accept Shabbat, and that her Beracha applies also to the electric lights in the room. After lighting the candles, she should then turn on the electric lights in the room.