context: In 1947, Andy Dufresne (Tim Robbins), a banker in Maine, is convicted of murdering his wife and her lover, a golf pro. Since the state of Maine has no death penalty, he is given two consecutive life sentences and sent to the notoriously harsh Shawshank Prison. Andy always claims his innocence, but his cold and measured demeanor led many to doubt his word.During the first night, the chief guard, Byron Hadley (Clancy Brown), savagely beats an overweight and newly arrived inmate because of his crying and hysterics. The inmate later dies in the infirmary because the prison doctor had left for the night. Meanwhile, Andy remained steadfast and composed. Ellis Boyd Redding (Morgan Freeman), known as Red, bet against others that Andy would be the one to break down first and loses a considerable amount of cash. Red has been in prison for several years having been given three consecutive life sentences for the murder of his wife and two others.About a month later, Andy approaches Red, who runs contraband inside the walls of Shawshank. He asks Red to find him a rock hammer, an instrument he claims is necessary for his hobby of rock collecting and sculpting. Though other prisoners consider Andy "a really cold fish," Red sees something in Andy, and likes him from the start. Red believes Andy intends to use the hammer to engineer his escape in the future but when the tool arrives and he sees how small it is, Red puts aside the thought that Andy could ever use it to dig his way out of prison.During the first two years of his incarceration, Andy works in the prison laundry. He attracts attention from "the Sisters," a group of prisoners who sexually assault other prisoners. Though he persistently resists and fights them, Andy is beaten and raped on a regular basis.Red pulls some strings and gets Andy and a few of their mutual friends a break by getting them all on a work detail tarring the roof of one of the prison's buildings. During the job Andy overhears Hadley complaining about having to pay taxes for an upcoming inheritance. Drawing on his expertise as a banker, Andy lets Hadley know how he can shelter his money from the IRS, turning it into a one-time gift for his wife. He says he'll assist in exchange for some cold beers for his fellow inmates while on the tarring job. Though he at first threatens to throw Andy off the roof, Hadley, the most brutal guard in the prison, agrees, providing the men with cold beer before the job is finished. Red remarks that Andy may have engineered the privilege to build favor with the prison guards as much as with his fellow inmates, but Red also thinks Andy did it simply to "feel free."While watching a movie, Andy demands "Rita Hayworth" from Red. Soon after, Andy once more encounters the Sisters and is brutally beaten, putting him in the infirmary for a month. Boggs (Mark Rolston), the leader of the Sisters, spends a week in solitary for the beating. When he comes out, he finds Hadley and his men waiting in his cell. They beat him so badly he's left paralyzed, transferred to a prison hospital upstate, and the Sisters never bother Andy again. When Andy gets out of the infirmary, he finds a bunch of rocks and a poster of Rita Hayworth in his cell: presents from Red and his buddies.Warden Samuel Norton (Bob Gunton) hears about how Andy helped Hadley and uses a surprise cell inspection to size Andy up. The warden meets with Andy and sends him to work with aging inmate Brooks Hatlen (James Whitmore) in the prison library, where he sets up a make-shift desk to provide services to other guards (and the warden himself) with income tax returns and other financial advice. Andy sees an opportunity to expand the prison library; he starts by asking the Maine state senate for funds. He writes letters every week. His financial support practice is so appreciated that even guards from other prisons, when they visit for inter-prison baseball matches, seek Andy's financial advice. Andy prepares Norton's tax returns the next season.Not long afterward, Brooks, the old librarian, threatens to kill another prisoner, Heywood, in order to avoid being paroled. Andy is able to talk him down and Brooks is paroled. He goes to a halfway house but finds it impossible to adjust to life outside the prison. He eventually commits suicide. When his friends suggest that he was crazy for doing so, Red tells them that Brooks had obviously become "institutionalized," essentially conditioned to be a prisoner for the rest of his life and unable to adapt to the outside world. Red remarks: "These walls are funny. First you hate 'em, then you get used to 'em. Enough time passes, you get so you depend on them."After six years of writing letters, Andy receives $200 from the state for the library, along with a collection of old books and phonograph records. Though the state Senate thinks this will be enough to get Andy to halt his letter-writing campaign, he is undaunted and redoubles his efforts.When the donations of old books and records arrive at the warden's office, Andy finds a copy of Mozart's The Marriage of Figaro among the records. He locks the guard assigned to the warden's office in the bathroom and plays the record over the prison's PA system. The entire prison seems captivated by the music  Red remarks that the voices of the women in the intro made everyone feel free, if only for a brief time. Outside the office, Norton appears, furious at the act of defiance, and orders Andy to turn off the record player. Andy reaches for the needle arm at first, then turns the volume on the phonograph up. The warden orders Hadley to break into the office and Andy is sent immediately to solitary confinement for two weeks. When he gets out, he tells his friends that the stretch was the "easiest time" he ever did in the hole because he spent it thinking about Mozart's Figaro. When the other prisoners tell him how unlikely that is, he replies that hope can sustain them. Red is not convinced and leaves, bitter at the thought.With the enlarged library and more materials, Andy begins to teach those inmates who want to receive their high school diplomas. After Andy is able to secure a steady stream of funding from various sources, the library is further renovated and named for Brooks.Warden Norton profits on Andy's knowledge of accounting and devises a scheme whereby he puts prison inmates to work in public projects which he wins by outbidding other contractors (prisoners are cheap labor). Occasionally, he lets others get some contracts if they bribe him. Andy launders money for the warden by setting up many accounts in different banks, along with several investments, using a fake identity: "Randall Stephens." He shares the details only with his friend, Red, noting that he had to "go to prison to learn how to be a criminal."In 1965, a young prisoner named Tommy (Gil Bellows) comes to Shawshank to serve time for armed robbery. Tommy is easy going, charismatic, and popular among the other inmates. Andy suggests that Tommy take up another line of work besides theft. The suggestion really gets to Tommy and he works on earning his high school equivalency diploma. Though Tommy is a good student, he is still frustrated when he takes the exam itself, crumpling it up and tossing it in the trash. Andy retrieves it and sends it in.One day Red tells Tommy about Andy's case. Tommy is visibly upset at hearing Andy's story and tells Andy and Red that he had a cellmate in another prison who boasted about killing a man who was a pro golfer at the country club he worked at, along with his lover. The woman's husband, a banker, had gone to prison for those murders. With this new information, Andy, full of hope, meets with the warden, expecting North to help him get another trial with Tommy as a witness. The reaction from Norton is completely contrary to what Andy hoped for. When Andy says emphatically that he would never reveal the money laundering schemes he set up for Norton over the years, the warden becomes furious and orders him to solitary for a month. The warden later meets with Tommy alone and asks him if he'll testify on Andy's behalf. Tommy enthusiastically agrees and the warden has him shot dead by Hadley.When the warden visits Andy in solitary, he tells him that Tommy was killed while attempting escape. Andy tells Norton that the financial schemes will stop. The warden counters, saying the library will be destroyed and all its materials burned. Andy will also lose his private cell and be sent to the block with the most hardened criminals. The warden gives Andy another month in solitary.Afterwards, Andy returns to the usual daily life at Shawshank, a seemingly broken man. One day he talks to Red, about how although he didn't kill his wife, his personality drove her away, which led to her infidelity and death. He says if he's ever freed or escapes, he'd like to go to Zihuatanejo, a beach town on the Pacific coast of Mexico. He also tells Red how he got engaged. He and his future wife went up to a farm in Buxton, Maine, to a large oak tree at the end of a stone wall. The two made love under the tree, after which he proposed to her. He tells Red that, if he should ever be paroled, he should look for that field, and that oak tree. There, under a large black volcanic rock that would look out of place, Andy has buried a box that he wants Red to have. Andy refuses to reveal what might be in that box.Later, Andy asks for a length of rope, leading Red and his buddies to suspect he will commit suicide. At the end of the day, Norton asks Andy to shine his shoes for him and put his suit in for dry-cleaning before retiring for the night.The following morning, Andy is not accounted for as usual in his cell. At the same time, Norton becomes alarmed when he finds Andy's shoes in his shoebox instead of his own. He rushes to Andy's cell and demands an explanation. Hadley brings in Red, but Red insists he knows nothing of Andy's plans. Becoming increasing hostile and paranoid, Norton starts throwing Andy's sculpted rocks around the cell. When he throws one at Andy's poster of Raquel Welch (in the spot previously occupied by Marilyn Monroe, and before that by Rita Hayworth), the rock punches through and into the wall. Norton tears the poster away from the wall and finds a tunnel just wide enough for a man to crawl through.During the previous night's thunderstorm, Andy wore Norton's shoes to his cell, catching a lucky break when no one notices. He packed some papers and Norton's clothes into a plastic bag, tied it to himself with the rope he'd asked for, and escaped through his hole. The tunnel he'd excavated led him to a space between two walls of the prison where he found a sewer main line. Using a rock, he hit the sewer line in time with the lightning strikes and eventually burst it. Crawling through 500 yards in the pipe and through the raw sewage contained in it, Andy emerged in a brook outside the walls. A search team later found his uniform and his rock hammer, which had been worn nearly to nothing.That morning, Andy walks into the Maine National Bank in Portland, where he had put Warden Norton's money. Using his assumed identity as Randall Stephens, and with all the necessary documentation, he closes the account and walks out with a cashier's check. Before he leaves, he asks them to drop a package in the mail. He continues his visitations to nearly a dozen other local banks, ending up with some $370,000. The package contains Warden Norton's account books, which are delivered straight to the Portland Daily Bugle newspaper.Not long after, the police storm Shawshank Prison. Hadley is arrested for murder; Red says he was taken away "crying like a little girl." Warden Norton finally opens his safe, which he hadn't touched since Andy escaped, and instead of his books, he finds the Bible he had given Andy. Norton opens it to the book of Exodus and finds that the pages have been cut out in the shape of Andy's rock hammer. Norton walks back to his desk as the police pound on his door, takes out a small revolver and shoots himself under the chin. Red remarks that he wondered if the warden thought, right before pulling the trigger, how "Andy could ever have gotten the best of him."Shortly after, Red receives a postcard from Fort Hancock, Texas, with nothing written on it. Red takes it as a sign that Andy made it into Mexico to freedom. Red and his buddies kill time talking about Andy's exploits (with a lot of embellishments), but Red just misses his friend.At Red's next parole hearing in 1967, he talks to the parole board about how "rehabilitated" was a made-up word, and how he regretted his actions of the past of murder over 40 years ago and no longer expects anything from them. His parole is granted this time. He goes to work at a grocery store, and stays at the same halfway house room Brooks had stayed in. He frequently walks by a pawn shop which has several guns and compasses in the window. At times he contemplates trying to get back into prison feeling that he has no life outside of prison where he has spent most of his adult life, but he remembers the promise he made to Andy.One day, with a compass he bought from the pawn shop, he follows Andy's instructions, hitchhiking to Buxton and arriving at the stone wall Andy described. Just as Andy said, there was a large black stone. Under it was a small box containing a large sum of cash and instructions to find him. He said he needed somebody "who could get things" for a "project" of his.Red violates parole and leaves the halfway house, unconcerned since no one is likely to do an extensive manhunt for "an old crook like [him]." He takes a bus to Fort Hancock, where he crosses into Mexico. The two friends are finally reunited on the beach of Zihuatanejo on the Pacific coast.
question: How did Andy escape?
answer: through the tunnel and prison sewage pipe