The U.S. Supreme Court created the exclusionary rule to enforce defendants' constitutional rights. Without this rule, criminal defendants wouldn't have a meaningful remedy for a violation of their rights.
American courts use the exclusionary rule to deter police officers and other government agents from abusing constitutional rights. According to the rule, courts will suppress (exclude) evidence that the government obtains through unconstitutional conduct—often an unlawful search or seizure.
In other words, police and other government officials have much to lose, and little to gain, by violating a defendant's constitutional rights. If police coerce a confession or conduct an illegal search to find drugs, the exclusionary rule prohibits the use of this illegally obtained evidence to prove the defendant's guilt. Loss of key evidence can derail the government's case—sometimes, completely.
(Mapp v. Ohio, 367 U.S. 643 (1961).)
Suppose officers, without reasonable suspicion or probable cause, stop a man walking down the street. Though he's done nothing to deserve it, they search him. They find in his pocket a scrap of paper saying, "Drugs are under garbage bin at 123 Jones Street." The officers go to the address, peek under the garbage bin they see there, and find a bag of various narcotics. Both the note and the drugs were a product of an illegal stop and search, so neither will be admissible to prove the man's guilt. Without this evidence, the prosecutor drops the charges.
The exclusionary rule applies to evidence that's a direct product of a constitutional violation. It also comes into play when such a violation leads less directly to incriminating evidence. This concept is known as "fruit of the poisonous tree." For instance, say police illegally search a suspect's home and find a list of drug buyers. Police interview one of the buyers and learn about a robbery. The exclusionary rule will prohibit both the drug buyer list and information about the robbery obtained from the interview. Even though police learned about the robbery from a different source, it stemmed from the original violation.
The exclusionary rule (like most legal rules) comes with exceptions. For instance, illegally obtained evidence cannot be used to prove the defendant's guilt, but it can be entered into evidence for other purposes—such as impeachment (to attack a defendant's credibility) or sentencing. Illegally obtained evidence might also come in if police relied in good faith on the validity of a search warrant that turns out to be bad. Several other exceptions exist, including where intervening events are said to "purge the taint" of police illegality or where police would have inevitably found the evidence.
The defendant must make a motion to exclude what it considers to be illegally obtained evidence, called a motion to suppress. In this motion, the defense needs to explain how the police or government violated the defendant's rights and why the illegally obtained evidence must be excluded. The prosecution will likely argue that the evidence was obtained legally, and even if it wasn't, some exception exists that allows the evidence to be introduced at trial.