What makes a great training session from a psychological point of view? A coach we work with closely in Montréal, Charles Gaston-Couturier, describes the challenge of a good training set using something he calls 'Sweet Uncertainty', based on work by Brunelle in 1988 .
Visually it looks a little like this:
The most common example of this form of motivation is when you set yourself a race or event goal, for instance "Next year I want to swim that hard 10km race" or "I want to complete an Olympic Distance Triathlon in 2:30".
The Flow State
Psychology Professor Mihaly Csíkszentmihályi describes how the motivation of a challenge leads to the 'flow state'  where all our emotions and our entire focus are aligned to help us achieve the goal:
"The flow state is being completely involved in an activity for its own sake. The ego falls away. Time flies. Every action, movement, and thought follows inevitably from the previous one... Your whole being is involved, and you're using your skills to the utmost."
In the sporting world we know the flow state as 'the zone'. Attempt something too easy and we become bored but try something too hard or beyond our skill level and we become anxious and demotivated by the futility of trying. Both extremes make it impossible for us to enter the zone, instead we need that point of uncertainty somewhere in-between.
Setting Yourself Regular Challenges
What is interesting to note is that this form of goal setting motivation (known technically as 'extrinsic self determined') doesn't just exist for mid and long term goals, it works session by session too.
So if you are bored or lacking motivation, try setting yourself regular mini-challenges in your training. This could be a set you haven't tried before or times and distances you are not sure you can complete. It might be leading your lane in the squad through a CSS set or matching a training partner who is slightly quicker than you.
Such challenges don't need to be set in every session because looking forward to them will motivate you in other sessions building up to them. But find that point of sweet uncertainty and motivation (and flow) will be yours.
 "La supervision de l'intervention en activité physique" by Brunelle, Drouin, Godbout et Tousignant
 "Beyond Boredom and Anxiety: Experiencing Flow in Work and Play" by Mihaly Csíkszentmihályi