[ARCHIVE ANSWER]
The police must have probable cause to pull you over. You must have committed a traffic violation of some sort. Police cannot just pull you over randomly.
The cop will probably arrest you for the traffic violation if you try to leave while they are deploying the K-9. However, if the cops take too long to get the dog and then find drugs, you will go to jail, but you can win the case in court. I was an expert witness in a case where the cop had only reasonable suspicions, and it took 45 minutes for the dog to
arrive. The judge ruled the motorist was detained too long and suppressed the evidence (one oz of meth). The guy walked free.
If you find yourself waiting for a sniffer dog, it will help if you tell the officers you know the detainment is illegal because it is taking too long, and you are going to sue them if they continue illegally detaining you. Keep asking if you are free to leave.