in a nutshell. All live ball fouls except 1 are enforced from the basic spot. That one foul that is not enforced from the basic spot is a foul by the offense which occurs behind the basic spot.
The basic spot for a running play is the end of the run
The basic spot for a loose ball play is the previous spot (usually limited to free kicks and pass plays)
The basic spot for a PSK enforcement is the end of the kick.
There is 1 notable exception. Roughing the passer is tacked on to the end of the run even though it occurs during a loose ball play.
These are the basics of the all but one principle
so endeth the lesson LOL