I don't think its as complicated as most of the people are making it out to be. You ask the officer if you are being detained, he has to tell you yes or no, if he dodges the question ask him again, if you are being detained (even "temporarily detained") you have to provide ID. If he says you are not being detained then you ask if you are free to go. If you're not being detained then they must let you go. They have 2 choice, 1. Detain you, 2. Not detain you. If they choose 1 you have to provide ID. If they choose 2 you can just walk/drive away, just ask them or let them know first so they don't shoot you in the back.