A Clockwork Orange

In futuristic London, Alex DeLarge is the leader of his "droogs", Georgie, Dim and Pete. One night, after getting intoxicated on drug-laden "milk-plus", they engage in an evening of "ultra-violence" including a fight with a rival gang led by Billyboy. They drive to the country home of writer F. Alexander and beat him to the point of crippling him for life. Alex then rapes his wife while singing "Singin' in the Rain". The next day, while truant from school, Alex is approached by his probation officer Mr. P. R. Deltoid, who is aware of Alex's activities and cautions him.
Alex's droogs express discontent with petty crimes and want more equality and high yield thefts, but Alex asserts his authority by attacking them. Later, Alex invades the home of a wealthy "cat-lady" and bludgeons her with a phallic statue while his droogs remain outside. On hearing sirens, Alex tries to flee but Dim smashes a bottle on his face, stunning him and leaving him to be arrested by the police. With Alex in custody, Mr. Deltoid gloats that the woman he attacked died, making Alex a murderer. He is sentenced to 14 years in prison.
Two years into the sentence, Alex eagerly takes up an offer to be a test subject for the Minister of the Interior's new Ludovico technique, an experimental aversion therapy for rehabilitating criminals within two weeks. Alex is strapped to a chair, injected with drugs, and forced to watch films of sex and violence with his eyes propped open. Alex becomes nauseated by the films, and then recognizes the films are set to music of his favorite composer, Ludwig van Beethoven. Fearing the technique will make him sick on hearing Beethoven, Alex begs for the end of the treatment. Two weeks later, the Minister demonstrates Alex's rehabilitation to a gathering of officials. Alex is unable to fight back against an actor that taunts and attacks him, and becomes ill at the sight of a topless woman. The prison chaplain complains Alex has been robbed of his freewill, but the Minister asserts that the Ludovico technique will cut down crime and alleviate crowding in the prisons.
Alex is let out as a free man, only to find his parents have sold his possessions as restitution to his victims, and have lent out his room. Alex encounters an elderly vagrant that he had attacked years earlier, and the vagrant and his friends attack him. Alex is saved by two policemen, but shocked to find they are his former droogs Dim and Georgie. They drive him to the countryside, beat him up, and nearly drown him before abandoning him. Alex barely makes it to the doorstep of a nearby home before collapsing.
Alex wakes up to find himself in the home of Mr. Alexander and cared for by his manservant, Julian. Mr. Alexander does not recognize Alex from the previous attack but knows of Alex and the Ludovico technique from the newspapers. He sees Alex as a political weapon, and prepares to present him to his colleagues. While bathing, Alex breaks into "Singin' in the Rain", causing Mr. Alexander to remember the previous attack. With help from his colleagues, Alex is drugged and locked in an upstairs bedroom, Beethoven's Ninth Symphony playing loudly from the floor below. Alex is unable to withstand the sickening pain and attempts suicide by throwing himself out the window, falling unconscious on the ground.
Alex wakes up in a hospital with broken bones. While being given a series of psychological tests, Alex finds that he no longer has an aversion to violence or sex. The Minister arrives and apologizes to Alex. He offers to take care of Alex and get him a job in return for his cooperation with his election campaign and public relations counter-offensive. As a sign of goodwill, the Minister brings in a stereo system playing Beethoven's Ninth. Alex then contemplates violence and has vivid thoughts of himself having sex with a woman in front of an approving crowd, thinking: "I was cured, all right!"

Question: Why does Alex try to throw himself out of the window?
Answer: To commit suicide.