The officer can follow you as long as he would like. He can pull you over only if he has articulable suspicion to do so. Meaning, he would have to witness an underlying traffic offense or behavior that is indicative of an intoxicated driver. Your best bet is to retain a DUI attorney to review the evidence and discuss your best bet to minimize the consequences of this arrest.
An officer can follow you around all day if he wants to, as long as he doesn't stop you without articulable suspicion. Most likely, the officer had a suspicion that you were DUI and wanted to confirm that suspicion before pulling you over. For instance, some officer's will not pull somebody over simply for crossing the center line once (unless it is an obvious weave). However, they might follow somebody who they saw cross over the line in order to determine whether they are having difficulty driving safely. If they cross over the line again, then the officer would initiate a traffic stop. Moreover, during this time that they are following you, they may also be recording your driving on video to be shown in court. Some officers do this to enhance their testimony about your impaired driving abilities.
You don't need to focus so much on what happened before the stop. There are three phases to a DUI investigation. This is only half of the first phase. The officer has documented something about your driving that made him suspcious that you were under the influence of alcohol and/or drugs. Next, the officer will record his initial encounter with you once you are stopped and out of the car. This is where the officer is asking you a bunch of questions and determining whether you are slurring, unsteady on your feet, etc. Then the officer asks you to perform some field sobriety tests. According to how badly you perform on those tests (walk-and-turn, one leg stand, etc.). The officer then might place you under arrest, read the implied consent card to you and request a chemical test of your blood, breath or urine. If you agree, you get tested. If you refuse, you go directly to jail.
There is room for defense in each one of these areas. For instance, there may be another explanation for your bad driving other than alcohol or drugs. Moreover, officers often exagerate their findings during the initial encounter; every DUI report I've ever read says that the person was unsteady on their feet, had bloodshot/watery eyes, and was slurring. However, many of the videotapes do not support these findings. Furthermore, field sobriety tests are subject to national standards. Officers often do not perform and/or grade these tests according to those standards. Finally, there are strict rules concerning chemical testing. If these rules are not followed, the results may be excluded from evidence.
You need to hire an experienced DuI attorney to handle your case. You may have one or more defenses that you don't know about that your attorney may spot right away. Don't continue to grasp at non-issues. Let an attorney handle this matter for you. That's what we have been trained for.