Right after you are stopped make sure you show the officer some courtesies: roll your window all the way down, turn your engine off, put your hands on the steering wheel so the officer can see them and if it is dark turn an interior light on. Do not start looking for your ID or your driver’s license in your pockets or glove box before the officer asks you. He could think you are reaching for a weapon.
Do not get out of the car unless you are asked to. If the officer ask you to step out he might pat you down to make sure you are not carrying anything dangerous.
Normally, a police officer is not allowed to search your car, but if the officer saw you trying to hide something while being pulled over or throw something out of the window, he might legally search your car.
If the car that made you pulled over is unmarked and you are concerned that the person who stopped you isn’t a real police officer, don’t hesitate to ask to see photo identification along with a police badge. If you still have doubts, you can ask the officer to call a supervisor on site or request to follow the officer to the nearest police station.