The Torah permits lighting a fire (hav’ara) on Yom Tov for tzorekh okhel nefesh (3:2 above). However, the Sages prohibited doing so (m. Beitza 4:7 and Gemara 33a), since creating something new is similar to performing a melakha. It is true that in order to cook and bake for Yom Tov, a fire is necessary. Nevertheless, since it is possible to light a fire before Yom Tov for use on Yom Tov, the Sages forbade lighting a new fire on Yom Tov (Beitza 33a-b; MT, Laws of Yom Tov 4:1; Rashba; SAH 502:1; MB ad loc. 1). Striking a match and turning on an electric light bulb are included in this prohibition (section 4 below).
Though lighting a new fire on Yom Tov is prohibited, adding fuel to an existing fire – whether wood, gas, or kerosene – is permitted. If an additional flame is needed to cook, a match or wood chip may be lit from an existing fire and then used to kindle a new flame. For these purposes, red-hot iron or red-hot coils are considered fire, as are smoldering coals. Therefore, one may light a match from them, as doing so is not considered creating a new fire.
Since lighting a new fire on Yom Tov is prohibited by rabbinic law and not Torah law, a non-Jew may be asked to light one for the sake of a mitzva or in a case of great need. For example, a non-Jew may be asked to turn on the lights or light a candle if the Yom Tov candles have gone out, the dining room is dark, and no pre-existing flame is available. Similarly, a non-Jew may be asked to turn on an electric heater if it is very cold.
Based on Rambam’s opinion that the prohibition of lighting a new fire is because it could have been prepared before Yom Tov, some say a fire may be lit on Yom Tov in the following two cases: if he was unable to do so before Yom Tov due to circumstances beyond his control (ones), or if he had lit a fire but it went out. The logic is the same as with makhshirei okhel nefesh (Birkei Yosef 502:1; Yaskil Avdi 4:27:2; Ḥazon Ovadia, p. 49). Others maintain that even if a person was unable to light a fire before Yom Tov, he still may not light one on Yom Tov. This position maintains that lighting a fire is comparable to creating a new kli. One may not do that on Yom Tov, even in a case where he could not have done it beforehand; see SA 509:2, SHT ad loc. 11, and elsewhere. Moreover, it should not be taught publicly that it is permissible on Yom Tov to take care of makhshirei okhel nefesh which could not have been prepared before Yom Tov (Minḥat Yom Tov 98:113; Minḥat Yitzḥak 4:99). Under pressing circumstances, when there is no neighbor from whom to “borrow” fire, one may rely on the lenient opinion. It is then proper to light with a shinui, which would render it permissible even according to the stringent approach. As for electric bulbs and appliances, it would seem that one may be lenient and turn them on with a shinui under pressing circumstances, even if they could have been turned on before Yom Tov, because aside from the aforementioned considerations for leniency, we can add the opinion that on Yom Tov, electric lights may be turned on even le-khatḥila (section 4 and n. 4 below). If one transgressed and lit a fire on Yom Tov, be-di’avad he may derive benefit from it (MB 502:4; as for benefiting from melakhot done on Yom Tov in a prohibited fashion, see ch. 8 n. 6 below).