I agree with Ian, but I would like to suggest a modification to his suggestion to "be more inclusive"
How about ..
I. When the leader has fewer than 3 laps remaining and the red flag is displayed, MRA officials may consider the race complete .... bla bla bla ..
So "fewer than 3 laps remaining" means when the red flag is called, the leader has already crossed start/finish and will cross start/finish one more time before being given the white flag.
So for a 7 lap race, the leader finishing lap 4 would trigger this situation. For a 14 lap RoR, the leader finishing lap 11 would be the trigger. For 20-30 minute endurances, I think we would figure out when the leader has fewer than 3 laps to go based on time left and average laptimes.
The reason I suggest this is we should allow endurances to keep going the same way as ROR and it should be a little easier to implement lap counts than calculating percentages of odd or even lap races. Also, for red flag restarts, the same "fewer than 3 laps" rule could apply pretty easily.