The following is not legal advice but is for information only. Legal advice is when an attorney applies the law to a person's individual circumstances and advises them on their legal options or potential exposure to legal harm, which a web page clearly does not.
According to the United States Supreme Court, despite what is in the Constitution (specifically the Fourth Amendment), police officers can detain a member of the public (such as in their car or while walking on the street) and they do not need probable cause (the Fourth Amendment’s standard for seizures) to deprive a person on their freedom to go about their day unencumbered by armed government agents.
This kind of brief detention (where a person is not free to leave) is called a Terry stop. It is supposed to be a brief detention of an individual by a law enforcement officer for the purpose of investigating suspicious behavior, where the officer has reasonable suspicion - with facts that can be given to by the officer to link behavior or facts to a potential offense. In the original Terry opinion the standard was articulated as suspicion that the individual has committed, is committing, or is about to commit a crime. Over time, what was already a rather tenuous decision over suspicion of a crime has eroded still further to include any number of petty civil violations - like a broken taillight in a car, not using a turn signal, staying in the middle lane of a highway, or many others that people commit on a daily basis. In short, it gives police enormous power to seize you for the silliest of reasons - and any they can come up with to stop any people they want to, even if it is for being suspected of doing something more serious and that petty reason is a pretext. The U.S. Supreme Court says that is also fine - stopping someone for a hinky reason that belies their actual reason.
The name "Terry" stop comes from the landmark U.S. Supreme Court case Terry v. Ohio, in which the Court upheld the legality of brief, warrantless detentions and frisks based on reasonable suspicion. The purpose of a Terry stop is to allow an officer to briefly investigate potential criminal activity without a warrant, but with what has been described as a ‘limited intrusion’ on the individual's liberty - but it is still a deprivation of freedom that needs legal justification.
However, those detentions have to have some basis - and sometimes that does not exist. It is up to your attorney to recognize that and make a legal argument that the stop was illegal.
During a Terry stop, the officer may ask the individual questions to confirm or dispel their suspicions. A person does not have to answer those questions - and if driving, just provide documents. A person can also be ordered out of a car for any reason or no reason. Some states require justification for that. Maine is not one of them. The officer may also pat down the individual's clothing for weapons if they have a reasonable suspicion that the individual is armed and dangerous. This rule and legal standard is often completely ignored. If the officer finds evidence of criminal activity during the stop, they may arrest the individual and conduct a more thorough search. Both an arrest and a search require probable cause.
Thankfully, however low this standard is (and continues to get lower), there are limits. For instance, a stop for a broken taillight doesn’t mean a vehicle search for drugs (unless the driver insists on talking their way into one rather than just not talking at all), or to keep a person longer than is needed to write a ticket and be on their way. Such a stop doesn’t allow sitting at the roadside waiting for a K9 to arrive and to sniff the car when stopped for speeding.
In circumstances where reasonable suspicion does not exist for a stop (a driver or pedestrian was doing absolutely nothing wrong to even deserve being detained), a person who has been stopped has little to no recourse. However it is only when someone is charged of a criminal offense that there is a remedy - when evidence obtained is excluded from the government’s case and known as suppression. This is via what has been long-standing and is known as the Exclusionary Rule. It is what gives the Fourth Amendment a remedy for a constitutional violation of an unreasonable search or seizure, even though the constitution does not explicitly state one. The Exclusionary Rule is supposed to act as a deterrence for law enforcement so officers comply with the constitution and not overstep its confines.
One final note on this subject. Maine has an equivalent to the Fourth Amendment in its own constitution - called Article 1 Section 5. However, it has become meaningless, while some states have given its citizens additional protections against unreasonable searches and seizures. Maine's highest court has instead opted to subcontract interpretation of Maine's constitution to federal courts - being a minority of a minority of states (six out of 13) to have never deviated from the Fourth Amendment and also be among the half dozen to say it will never do so.