Ok so the penalty system:
You get various penalties from different spots. Those can be specified by the track maker and even altered by modders or league admins in the surfaces.ini file. The server will make sure that server and clients have the same surfaces.ini
When you get a penalty, you are supposed to raise your foot from the gas pedal for X seconds (time depending on the place you got the penalty) or go under 35km/h. You can do whatever you like, whenever you like, BEFORE you finish your lap.
If you get a penalty and then you get a second penalty, then you can't go under 35km/h any more. You have to raise your foot from the gas pedal for the sum of the penalties. Again you must do so before you cross the start/finish line in the same lap you got the penalty
If you don't do the penalty and you start another lap, then you are disqualified.
Penalties work like that in race mode. They do not work in practice, time attack, hotlap, qualifying. When you get a penalty in such situations the laptime simply won't count.