The story of Rita Hayworth and Shawshank Redemption begins in 1948 when Andy Dufresne arrives at Shawshank prison. In contrast to most other convicts, Dufresne is not a hardened criminal but a soft-spoken young banker, convicted of killing his wife and her lover. His crime bears many similarities to the real-life Sam Sheppard case. Like almost everyone else in Shawshank, Dufresne claims to be innocent. As we later learn throughout the novella, Andy, unlike almost everyone else in Shawshank, actually is innocent.
Red, the narrator, has an ability to deliver contraband of almost any type (except hard drugs and weapons) into Shawshank. This makes him an important man within the prison's social structure - "I'm a regular Neiman-Marcus", he tells us - and it is also the reason that he first becomes acquainted with Andy.
As a free man, Andy had been a rock-hound, and now he has immense amounts of free time on his hands, so he asks Red to get him a rock hammer, a tool he uses to shape the rocks he finds in the exercise yard into small sculptures. The next item he orders from Red is a large poster of Rita Hayworth. When taking the order, Red reflects that Andy is, quite uncharacteristically, excited like a teenager about the poster, but does not think more of it at the time.
One spring day, Andy and Red and some other prisoners are tarring a roof when Andy overhears a guard griping over the amount of tax he will have to pay on an inheritance he has just been left by an estranged brother. Andy approaches him (almost getting thrown off the roof in the process) and tells him that he can legally shelter the money from taxation. Andy offers to help the guard to prepare the necessary paperwork for the transaction, in exchange for some beer for the other prisoners on the roof. The guard agrees, and as word of the occurrence spreads, more and more of the prison staff discover that they can use Andy's help for tax returns, loan applications, and other financial advice, at no charge, of course. He quickly becomes a valuable asset for the staff, and the warden.
A gang of aggressive prisoners called "The Sisters", led by Bogs Diamond, gangs up on and rapes any prisoners they feel they can handle, and Andy is no exception. However, when Andy makes himself useful to the guards, he gets protection from "The Sisters". One night Bogs is found in his cell, unconscious and severely beaten. Andy is also allowed to stay alone in his cell instead of having a cell mate like most other prisoners. For a short period, he shares a cell with an Indian called Normaden, but is soon alone again, Normaden having complained about a "bad draft" in the cell.
Andy's work assignment is shifted from the laundry to the prison's small library, then under the stewardship of Brooks Hatlen, one of the few other prisoners with a college degree. Red dryly notes that Brooks' degree is in animal husbandry, "but beggars can't be choosers." The new assignment also allows Andy to spend more time doing financial paperwork for the staff. When Brooks is paroled, Andy takes charge of the library and starts to send applications to the Maine state Senate for money for books. For a long time he gets no response to his weekly letters until the Senate finally relents, thinking Andy will stop requesting funds. Instead of ceasing his letter writing, he starts writing twice as often. His diligent work results in a major expansion of the library's collection, and he also helps a number of prisoners earn equivalence diplomas, preparing them for life after parole.
The warden of Shawshank, Norton, also realizes that a man of Andy's skills is useful. He has started a program called "Inside-Out" where convicts do work outside the prison for minimum wages. Normal companies outside cannot compete with the cost of Inside-Out workers, so sometimes they offer Norton bribes not to bid for contracts. This cash has to be laundered somehow, and Andy makes himself useful here as well.
One day, Andy hears from another prisoner, Tommy, whose former cellmate had bragged about killing a rich golfer and some hot-shot lawyer's wife (Andy interprets "lawyer" to mean "banker"), and framing the lawyer for the crime. Upon hearing Tommy's story, Andy sees the possibility of a new trial that may prove he is innocent. Norton scoffs at the story, however, and as soon as possible he makes sure Tommy is moved to another prison, presumably as compensation for promising that he never talk about this anymore. Andy is too useful to Norton to be allowed to go free, and furthermore he knows details about Norton's corrupt dealings. After spending a couple of months in solitary, Andy resigns himself that the prospect for his legal vindication has become non-existent.
Before being sentenced to life, Andy managed, with the help of his law partner, to sell off his assets and invest them under a pseudonym. This made-up person, Peter Stevens, has a driver's license, social security card, and other credentials. The documents required to claim Peter Stevens' assets and assume his identity are hidden under a black rock in a rock wall lining a hay field in the small town of Buxton, not too far from Shawshank.
After eighteen years in prison, Andy shares the information with Red, describing exactly how to find the place and how one day "Peter Stevens" will own a small seaside resort hotel in Mexico. Andy also tells Red that he could use a man who knows how to get things. Red, somewhat confused about why Andy has confided this information in him, reflects on Andy's continued ability to surprise.
One morning after he has been incarcerated for nearly twenty seven years, Andy disappears from his cell. After searching the area without finding him, the warden looks in his cell and discovers that the poster on his wall (now showing Linda Ronstadt) covers a man-sized hole. Andy had used his rock hammer not just to shape rocks, but to dig a hole through the wall. Once through the wall, he broke into a sewage pipe, crawled through it for some 500 yards, emerged into a field beyond prison's outer perimeter and vanished. His rock-hammer and prison uniform are found outside the pipe. How he got any further away from there with no equipment or clothing, nobody can determine.
A few weeks later, Red gets a blank postcard from a small town near the Mexican border, and surmises that Andy crossed the border there. Shortly afterwards, Red is paroled. After forty years' imprisonment, he finds the transition to life "outside" to be a difficult process. On the weekends, he hitch-hikes to Buxton, searching for suitable hay fields from Andy's "directions". After several months of wandering the rural town roads, he does find a field with a rock wall on the correct side. It even has a black rock in it. Under this rock, he finds a letter addressed to him from "Peter Stevens" inviting him to join him at the town he had told him about. With the letter are twenty fifty dollar bills. The story ends with Red violating his parole to follow Andy to Mexico.