The Fourth Amendment to the United States Constitution reads:
The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.
The United States Supreme Court has ruled that in addition to including federal government, the Fourth Amendment also applies to the states. This means that it covers agencies like the State Police in addition to the Federal Bureau of Investigation and other federal law enforcement agencies. Because a violation of the Fourth Amendment can cause a case to be thrown out of court, law enforcement personnel are very careful about how and when they search people and property.
Under the terms of this amendment, law enforcement personnel can initiate a search if they have probable cause; for example, a police officer can ask a driver to take a blood alcohol test if he or she is driving erratically. This is deemed reasonable because of the probable cause, and because drivers must sign a statement indicating that they are willing to submit to such tests in order to be licensed in many states. By contrast, a police officer cannot pull over a random driver and search his or her car for no reason, because this is an unreasonable search.
A search may also be initiated if a warrant is issued by a judge or another official authorized to do so. In a warrant application, a law enforcement agency must detail what they want to search and why, and the judge must determine whether or not the situation merits a warrant. Even with a warrant, a search can still violate the Fourth Amendment, so judges tend to be cautious.
There are exclusions to the Fourth Amendment. It does not cover what are known as “plain view” seizures and searches; in other words, if there's an open container of alcohol visible on a passenger seat, a police officer can confiscate it, and use it as probable cause to search the vehicle. The plain view exclusion is also often assumed to include trash cans. The Fourth Amendment also only applies to government entities; private companies and individuals are on their own, although they could be prosecuted for trespassing and other violations of the law.