First, under NFHS Rules, there is no time run off for fouls or injuries that occur with less than one minute remaining in a half.Offense driving with the ball at the end of the half/game. No time outs left and clock is winding down. Offensive player is tackled in bounds and the offensive team tries to line up quickly to spike the ball and stop the clock. They snap the ball with 1 second but they have an illegal formation/motion. The penalty is called and the clock stops at 1 second. Do they get another play or should there be a run off?
Next, a foul for illegal motion or illegal formation (these are live ball fouls at the snap) would only be enforced if the offended team accepted the penalty. (the defense would be nuts to do so and no official would even make that offer available to them)
Had there foul been a live ball foul against the opponent in this situation (illegal participation, holding, facemask...etc...) then the offended team would most certainly accept the penalty and the half would be extended with an untimed down.