Sam Wheat (Patrick Swayze), a banker, and Molly Jensen (Demi Moore), a potter, are a couple who renovate and move into an apartment in New York City with the help of Sam's friend and co-worker Carl Bruner (Tony Goldwyn). One afternoon, Sam discovers unusually high balances in obscure bank accounts, but despite Carl's offer to help investigate, Sam decides to investigate on his own. That night while walking home together Sam and Molly are mugged by a street thug who pulls a gun and demand's Sam's wallet. Sam struggles with the attacker and is shot. After pursuing the street thug, Sam runs back to Molly and—seeing her crying over his dead body—discovers that he has died from the gunshot and has become a ghost. Sam stays by the distraught Molly, trying to come to grips with his new condition, when Carl comes over and suggests Molly take a walk with him. Sam cannot bring himself to follow.
Moments later, the mugger enters the empty apartment and commences searching for something. When Molly returns, Sam scares their cat into attacking the thug, who flees. Sam follows the mugger to his apartment in Brooklyn and learns that the man's name is Willie Lopez and that Willie intends to return later to continue the search.
While walking back to the apartment, Sam happens upon the parlor of Oda Mae Brown (Whoopi Goldberg), a con artist posing as a medium. But when she can hear Sam, she realizes she has an actual gift. He convinces her of the danger that Molly is in and that Oda must warn her. Molly is skeptical about Oda until Oda relays information that only Sam could know.
After Molly tells Carl about Oda Mae, Carl—unaware that Sam is following—then goes to Willie's apartment. There, to Sam's surprise, he finds that Carl and Willie are working together, that Carl had a hand in Sam's death, and that he had needed to obtain Sam's book of passwords in order to access and launder the excess money from the bank accounts. Under instructions relayed from Sam to Oda Mae, Molly goes to the police with Willie's name and address, but they find no criminal record of him—instead they show her Oda Mae's record and convince her that she's a con artist.
Meeting a violent poltergeist in their ghostly realm, Sam learns from him how to manipulate physical objects from within the spirit realm. Sam then approaches Oda Mae and asks her not only to withdraw the money in the fake name that Carl had set up but then to give that $4 million to charity. Sam tries to scare Carl away from Molly but she reveals to Carl that Oda Mae was at the bank withdrawing the money. Sam then prevents Oda Mae from being attacked by Willie, terrorizing the thug and then sending him into oncoming traffic where Willie is hit by a car and killed. As Willie's ghost is grabbed by creatures from the shadows that drag him to Hell, Sam and Oda Mae return to the apartment where—by levitating a penny into Molly's hand—he convinces Molly that Oda Mae is telling the truth about him.
Oda Mae allows Sam to possess her body so he and Molly can share a slow dance, but Carl interrupts them and Molly and Oda Mae flee onto the fire escape. Carl chases the women to a loft under construction and catches Oda Mae. When Molly comes to save her, she is grabbed and held hostage. Sam disarms Carl and chases him toward a window. He throws a suspended hook at Sam; it misses, swings back, and shatters the glass. As Carl tries to climb through the window, a sharp shard of broken glass falls, impaling him in the stomach. Carl's ghost rises from his body and, as Willie had been, he is grabbed by the creatures from the shadows and is carried to Hell.
Sam asks if the women are all right. Miraculously, Molly can now hear him. A heavenly light shines in the room, illuminating Sam in sight of both of them. Realizing that it is his time to go, he and Molly share tearful goodbyes. Oda Mae tells him that he is being called home, and he thanks her for her help.
Sam then walks into the light and onward to Heaven.

Question: Why was Sam killed?
Answer: Carl was laundering money, and Sam had found the bank accounts
Alternative answer: To obtain his book of passwords which was needed to launder money