I never have problems with police... I've been pulled over twice, I was friendly and cooperative and was treated the same. Both times I was let go with a verbal warning. I've been sorta involved in a bar fight... I helped to break it up, but if an officer had walked up in the middle of it he would have mistaken me for one of the drunken disorderly fighters. I was handcuffed and put in the back of the car where I sat for 20 minutes just waiting while they sorted stuff out... then an officer came and talked to me about what happened and he verified my story with the bartender and bouncers and let me go. If I had been sitting back there kicking the window yelling "let me go, I didn't do anything you pigs!" I most definately would have gone to jail.
If you're a smartass to a cop, trying to argue whether they can detain you or not, they're going to find a reason to detain you and give you a hard time... just like you went out of your way to give them a hard time. Police have no tolerance for smartass teenagers... they deal with those types every day, and if you're a smartass teenager, you're just another pain in their ass, so don't expect to be treated any differently.
*EDIT* On a side note, they have a reason for asking you to do certain things. When you get pulled over, don't rummage through your glove box looking for your registration... for all they know, you're looking for a gun or a knife. Leave your hands on the steering wheel in plain sight and don't do a damn thing until they ask you to. Since I didn't use to have power windows, I didn't even roll my window down before they got to the car, cause again, for all they know, you could have a gun or a knife sitting on the floor there. If you're not in a car and for whatever reason, they feel the need to handcuff you or search you, allow them to. You don't have to be under arrest to be handcuffed... they can chose to handcuff you and put you in the back of their car for their own safety if they're talking to someone else and think you might become a problem for them. When they tell you to put your hands on the car, or a wall and spread your legs... don't just casually stand there with your legs apart a little bit... that annoys the shyt outta them because the whole reason for having you in that position is not to search you, it's to put YOU in such a position that you can't move quickly to attack them while they're searching you. So if you submit, and put yourself in a vulnerable position and leave them in the position of power, they'll be less aggrivated with you.
BTW... you're required by law to present identification when requested by a police officer. They don't need anything "on you."