A traffic stop normally ends with a citation—the annoyed motorist simply drives away. But an officer will sometimes prolong a traffic detention, in the process searching the driver’s vehicle.
(For information on a related topic, see Is a traffic stop an “arrest” within the meaning of Miranda?)
An officer who issues you a citation and doesn't have a basis to suspect that you are armed and dangerous or involved in criminal activity (other than the minor traffic violation) often cannot search you or your car. But note that laws in many states authorize police officers to arrest drivers for minor traffic offenses, such as speeding or failure to wear a seatbelt. In these and other instances of arrest, the validity of a subsequent search depends on the circumstances.
After arresting an occupant, the police may search the passenger compartment of a vehicle if it reasonably appears that the arrestee might access the vehicle during the search or that the vehicle contains:
The ensuing search must be limited to areas that might contain the items the searching officer reasonably expects to find.
If, for example, officers have arrested a motorist for driving on a suspended license, handcuffed him, and placed him in a locked patrol car, they don’t have a lawful basis to search the car. The driver isn't able to access the car at the time of the search, nor can the officers reasonably expect to find evidence of the crime for which they arrested him: driving on a suspended license. (Arizona v. Gant (2009) 556 U.S. 332.)
But even without an arrest, an officer who sees, hears, or smells something suspicious during a traffic stop can probably search the car. And if the police conduct a traffic stop and arrest and frisk the driver, thereby finding contraband, they can likely search the vehicle. Further, police officers can often search cars after arrest pursuant to the inventory search exception.
If a police officer requests your consent to search your car, you don’t have to give it. Oftentimes officers use the driver’s consent as a basis to conduct a search that would have otherwise been illegal. Of course, it’s easier in theory than in practice to say “no” to an intimidating cop.