Yes I do believe the aircraft are required to have these lights by law. It's like ships at sea. The red and blue lights on the wingtips designate port and starboard. That way you can tell if it is coming at you, or going away from you. So you can avoid it. It's kind of useless with radar, but if radar fails you have to depend on visuals, and the lights are the best way.
It is regulation, and it is law.
I do suspect some military aircraft do not have or use it... for some obvious reasons.
But ... to your question about flashing lights .. I am not 100% sure, but I think it is law.