If you're behind someone and you are doing more than 35 miles per hour and there is less than a two-three second gap, (in good conditions, double this in poor conditions) then you are too close.
There's no point in being closer; it's extremely rare that people will speed up if you tailgate them. Indeed they may well slow down... or brake test you. Additionally, being too close is dangerous because you can't see so well yourself, if an animal runs in front of the vehicle ahead, or some other problem happens, you have much worst chances, and the insurance companies will blame you anyway. So, tailgating is counterproductive; you're much better off hanging back.
It doesn't matter how fast the car in front is going, but if they are going more slowly it is easier for you to pass; you probably should if you can.
Note also that the two-three second gap rule gives you a cushion that you can use. If you anticipate a potential passing space coming up; even before you even know it is definitely there, you can accelerate. If there turns out to be a gap, you will have extra speed to get past safely, if not you can brake. Doing this will usually leave anyone who may be tailgating you in turn in your dust...
Besides- it's more relaxing hanging back, and it doesn't actually slow you down. You can't get there before the person infront anyway; unless you can pass them, and tailgating them makes it harder to pass them.