Same thing in endurance sports racing (running, cycling, etc.). Mentally break the race down into little pieces. Just suffer for one more minute. Make it to the next mile marker.
Hah! When I’m doing reps at the gym, I’ll count down the Fibonacci sequence, so a set of ten I’d count five, then three, then two. Works like a charm when each subset is “easier” than the previous one.