Probably not dangerous with if the light doesn't power on. Fans are dangerous if turned on when not working because they have an electric motor, whose internal resistance depends on the amount of work the motor is performing. If the electric motor isn't preforming work (IE the fan blade isn't spinning) its resistance goes to 0 and it starts heating up due to an excessively high current flow. This leads to fire.
Light bulbs work in a different way. They don't have electric motors.. But instead are solid state devices that basically convert electricity into light/heat, very efficiently.
If they aren't working its because current isn't flowing thru them. So a lightbulb that doesn't work isn't dangerous (current flow -> heat -> fire, no current no heat, no fire). What is dangerous however is a fixture that isn't working.
Caveat This assumes that voltage applied is not higher than the lightbulb was designed for. Incandescent bulbs which convert electricity into light very inefficiently can get extremely hot, and start fires. LEDs will explode if too much current is applied (I haven't seen that cause a fire, its not much of an explosion, but it could happen). Fluorescent, halogen, etc.. can get pretty hot as well.
You have a bad fixture.
One of the fixtures sometimes fails to light up so I have to flick the switch back and forth until all of them light up.
This is concerning. Out of curiosity can you smell any ozone in the room?
Your fixture most likely has a loose wire that sometimes comes in contact and/or arcs allowing the lightbulb to turn on. This is bad as arcs can start electrical fires, but as long as all your wires are inside of an electrical box the chance of one starting is low.
How do I fix this
Open up your problem fixture, check all of the wire nuts and replace the one that is partially melted/charred. Taking extra care to tighten it properly.
"Loose wires cause fires."