If one lit Shabbat candles before dark, had them burning during dinner, and now wants to go to bed, but is worried that a cat or a dog might knock them over and cause a house fire; is it permissible to blow them out in the interest of safety?
The practice of lighting shabbat candles is a rabbinic requirement (see, e.g. Babylonian Talmud, Tractate Shabbat 25b; Rambam Laws of Shabbat 5:1), to honor the Shabbat and create a pleasant and peaceful atmosphere in the home (see e.g. here). According to most, the requirement may be fulfilled using electronic lights (at least incandescent ones) that serve the same purpose, at least if there is a need (see, e.g. here, here, and here). Extinguishing a flame is severely prohibited on Shabbat, in many instances, biblically (see, e.g. Tractate Shabbat 2:5). Nonetheless, one must extinguish flames to avoid a risk of loss of life (id; see, e.g., Rav MiBartenura, ad loc) provided there is no alternative permitted way to avoid that risk. One would not, however, be allowed to light candles Friday if he knew he would then have to extinguish them on Shabbat (see, e.g. Responsum of Rivash 18 cited by Magen Avraham 248:13), at least if he could light in a way that would avoid that need (e.g. by using electric lights). But see also Shulchan Aruch Orach Chaim 248:4 from which it seems implicit that, in a scenario where one could only fulfill the obligation of lighting by entering into a dangerous situation that would require desecrating Shabbat to avoid the danger, one would still be allowed/obligated to light, and deal with the danger if and when it came. (As always with regard to questions on this forum, for practical guidance, please consult a competent halachic authority.)