Stay Positive. When I start a century there is never any doubt in my mind that I will finish. I find if I doubt myself, it becomes a self fulfilling prophecy of failure.
Instead, I visualize finishing the ride with the cheerleaders cheering for me at the end. Then I see myself relaxing after the finish, eating my pie and ice cream.
If I am hurting towards the end of the ride, I try to remember what I love about cycling. I focus on the natural environment around me and the feel of accomplishment, knowing I have traveled a great distance under my own power. I find seeing the positive aspects of the ride helps me put any temporary discomforts out of my mind.