We humans are a bit obsessed with 'endings'. We want movies to end well otherwise it may ruin the whole experience. Why is that? Memory is like looking out of a window in a moving train. What you saw last is most likely what you will remember. This is what the Peak-End rule is all about. The theory that was put together by Nobel winning economic scientist Daniel Kahneman (of the wonderful book 'Thinking, Fast and Slow'), who says that people tend to appreciate an experience more if the ending is better than the part in the middle or the beginning. So much so that this still works in cases where the overall experience may be worse but as long as there is a happy ending, people will prefer that over a better average experience with a less happy ending.
In a famous experiment, Kahneman and his colleagues had people place their hand in water that was 14 degrees Celsius for 60 seconds. That is pretty cold and not comfortable at all. A second trial had them submerge their hand in 14 degree cold water for the same 60 seconds but added a 30 seconds where the water has heated to 15 degrees. Now, let's be clear here; 15 degrees is still very cold and unpleasant. But, when asked which trial the participants preferred, they all chose the second one which had a longer duration of unpleasantness but ended on a higher note. Since then the experiment has been tried and tested many times and proven correct every time.
What does that mean for you? It means that you should think about the different experiences your customers are having with your products or services. Or maybe just the interactions with your people, how can you design the experience so that it ends on a high note? This is especially true for situations that are less pleasant like in case of a broken product or service. Make sure you give that customer a happy ending, not matter how painful the process was, because they will remember the bit at the end the most. And if that hits a high - they'll be much happier with you.