From 2020 NFL Rule Book (I placed asterisks at the pertinent section)
ARTICLE 2. SCRIMMAGE DOWN
Following any timeout (3-37-1), the game clock shall be started on a scrimmage down when the ball is next snapped, except in the following situations:
Whenever a runner goes out of bounds on a play from scrimmage, the game clock is started when an official spots the ball at the inbounds spot, and the Referee gives the signal to start the game clock, except that the clock will start on the snap:
after a change of possession;
after the two-minute warning of the first half; or
inside the last five minutes of the second half.
If there is an injury timeout prior to the two-minute warning, the game clock is started as if the injury timeout had not occurred.
If there is an excess team timeout after the two-minute warning, the game clock is started as if the excess timeout had not occurred.
If there is a Referee’s timeout, the game clock is started as if the Referee’s timeout had not occurred.
*****If the game clock is stopped after a down in which there was a foul by either team, following enforcement or declination of a penalty, the game clock will start as *****if the foul had not occurred, except that the clock will start on the snap if:
*****the foul occurs after the two-minute warning of the first half;
*****the foul occurs inside the last five minutes of the second half; or
*****the offense commits a foul after the ball is made ready for play, and causes the clock to stop before a snap, during the fourth quarter or overtime; or
*****a specific rule prescribes otherwise.