Also, of course, godspeed Paul Walker. You are missed by many.
Before talking even begins, you should know that you will never ever ever talk your way out of a ticket. Your attitude and actions may very well allow you to talk yourself into one, though.
Patrol car behind you: "Oh shit." Red and Blue lights come on: "FUCK."
Turn on your dome light. Right then. Pull over as soon as you can. As far to the right as you can in a safe (for both of you) area. If you can say the alphabet and you still haven't pulled over, turn on your hazards to let the officer know you are complying.
When you get to the side of the road, put the car in park and shut it off. Do not get your license. Do not get your insurance card. Roll the window down and leave your hands open at 11 & 1 on the steering wheel. The officer will approach quickly.
"Good evening, I'm Deputy Andysthirsty with the Reddit Sheriff's Department. The reason I stopped you is that your registration expired 4 months ago. Can I please see your drivers license and proof of insurance?"
"Absolutely. My license is in my back pocket in my wallet, and insurance is in the glove box."
"Go ahead and grab those."
See what happened there? No excuses, I was never interested in them, although spontaneous statements of guilt are admissible in court. Answer simple questions directly and follow instructions. The driver waited to grab at "potential weapon hiding areas" until the officer was in a position to observe the areas....
"were you aware that your registration was expired?" Be honest.
The alternative to the above is "...do you have any idea why I stopped you?" Confess your sins. Yes, these are statements of guilt. However, you're an adult, and guilty. Take some responsibility. Also, saying "I don't know" makes you appear like you're not really paying attention to the operation of that 3,000 lb death machine. Confessing for traffic offenses might even get you out with a warning. Don't lie. Don't cuss. Don't be a jerk. Officer discretion is an amazing thing.
Now on to the hard stuff.
"Do you have drugs, weapons, or anything illegal in the vehicle?" No, officers don't just ask this to everybody they stop. They're seeing red flags. Answer directly with "No." Don't say anything else. Not a word.
"Since you have nothing to hide, do I have your permission to search your vehicle?" Some officers will say something like, "can I have a look around your car?". Case law be damned, there are still a ton of officers pulling this crap.
Say "no." Nothing else. Not a word. Even if you have nothing illegal. If they have probable cause, they'll detain you and search anyway. If they ask you why not, tell the officer you're embarrassed by the idea of a police officer digging through your stuff, and you'd like to be on your way. Officers cannot hold a ticket over your head in exchange for permission to search. If they do, take the ticket and let the lawyers sort it out.
If you're arrested... Shut your fucking mouth. Don't say anything. Do not talk to the police. Get a lawyer. No, you are not good enough or smart enough to talk your way out of this. Nobody is. There is a high likelihood that a lawyer will be able to find a flaw in the officers case... that likelihood drops by about 90% once you say anything.
I say this because I've worked with and around some shady cops. Too many years on the job, or whatever the reason, they are out there. Cops are not the moral protectors of humanity. Many don't deserve much praise, honestly.
Source: Deputy Sheriff in Missouri for 5 years. Pay was shit. Left on good terms for a job that pays very well.