Can the police detain the vehicle and its passengers beyond the time needed to handle that traffic stop?
The police can do something like this so long as they have a reasonable cause to do so. They cannot simply detain the car and the passengers because they feel like it or because they have some vague suspicion that a crime has been committed. Of course, there is no clear line between a reasonable suspicion and an unreasonable one.
The rule of thumb, then, is that the officer has the right to do all of the things that are needed for a routine traffic stop. If, in the process of conducting that stop, the officer comes to have a reasonable suspicion that some crime has been committed (the typical example would be drug possession), the officer may prolong the stop and detain the car.
As long as the officer has initiated the stop and has probable cause, a resonable belief grounded on facts, they may hold you there as long as they need you to be there. However; they may not hold you simply to teach you a lesson for speeding, etc. This can be the case though if the officer can show the magistrate or judge that he/she had probable cause to hold you at the scene of the traffic stop then all claims of a false arrest, etc. are then thrown out the window.
Quoting from; Florida v. Royer, US SC;
...This much, however, is clear: an investigative detention must be temporary, and last no longer than is necessary to effectuate the purpose of the stop....
A traffic stop is an investigative detention, more analogous to a Terry Stop (Terry v. Ohio), (reasonable suspicion an offense has occurred) rather than a reasonable cause/probable cause stop.
When a motor vehicle is seized (stopped) ALL passengers can challenge the constitutionality it, see Brendlin v. California, US SC.
One case I have in my head is if a Terry Stop exceeds a reasonable time limit, it then turns into an actual arrest.
While there is no bright line time for an invetigative detention to finish, we can assume 10- 20 minutes is not out of the norm.
For some interesting reading, you can read this case from the Ohio Supreme Court, citing the Royer Court.