It's good advice to not give the cops ANYTHING you don't need to give them. Keep answers short and on-point, don't volunteer anything, don't sign anything without a lawyer, and if you get the feeling this is going south it's better to say you'd rather have your lawyer present than continue answering questions... You never know what will affect you in what jurisdiction and all you need to be is 1 inch over a state line to have those laws end your freedom.
Also, and this is a HUGE issue with especially younger people, SPEAK UP AND DON'T SLUR YOUR WORDS. Just speak clearly, look them in the face, and respond. "Yes sir, no sir..."
If you're pulled over for a broken taillight and it's turning into a whole "thing" then ask if you're free to go. If the answer is no it may be a better idea to get a lawyer involved BEFORE you answer something potentially incriminating. Remember, in the US (at least for now) and Canada you're entitled to legal representation. If you don't have your own lawyer (I don't have one on call) then tell them you don't have a lawyer personally but you need one to represent you during questioning.
What with the Orange Emperor deciding he wants to just deport anyone to anywhere he wants it's best to avoid ending up in custody in the US.
In Canada it's not so dire, but the advice to avoid volunteering information and keeping answers short and to the point stands.
I have friends who are cops, I know that if they THINK you're guilty they'll find something to charge you with while they figure out how to get you on the other thing.
Of course, none of this fixes racism/sexism (or other prejudicial) issues or issues faced by people who struggle in social settings, which gives false red-flags to cops as bad as racism or sexism does, but at least if you do your best to expedite the experience and get to a ticket and/or a warning and get released then you're not in custody. If the ticket is bullshit, say nothing and just challenge it in court. Pissing the cop off is only going to make them want to fuck with your day.