The ending is an odd one in Shawshank, so odd, in fact, that the movie took creative license to clarify certain details that Mr. King left out (Hollywood hates leaving us hanging.). The story ends with Red telling us about Andy's escape, which is followed by a postscript saying he's been paroled, has found a bunch of cash Andy left for him, and is heading down to Mexico to find him. There's no word on whether he gets there, though he uses the word "hope" a lot during the last few sentences:
I hope Andy is down there. I hope I can make it across the border. I hope to see my friend and shake his hand. I hope the Pacific is as blue as it has been in my dreams. I hope. (541-544)
Four sentences, five "hopes." The story stresses the power of hope throughout—Hope that things will get better in a tough world, hope that a jerk like Warden Norton will get what he deserves, hope that the heroes will die on a beach in the Pacific instead getting gang-raped in the shower of a Maine prison.
Hope is strongest when there's no resolution; if we find out what happens, we're not hopeful, only relieved. So when King keeps us from finding out if Red really makes it across the border. He just leaves us feeling… well, you know.
On a more literary level, it also keeps with King's general dedication to realism. Supposedly, Red is writing his story down and leaving it somewhere, suggesting that he's a real con with a real tale to tell. If he were actually about to break parole and escape to Mexico, he wouldn't come back to his diary to tell us if he got there or not. So not only does Rita Hayworth and the Shawshank Redemption's cliffhanger ending serve a useful point, it helps keep the book's overall "this could really happen" vibe intact.