There are two checkpoints in a stage, one at the beginning and one at the end of it.

If you don’t complete a level, you will go back to the previous checkpoint, but you won’t go back to the previous stage.

Also, when you reach the next checkpoint, you will collect all the pending rewards.