With a cough, when do you know that it's time to visit the doctor?

Several factors. Duration of cough. If you have been coughing more than 7-10d. If you are coughing blood or what looks like pus. If you have other symptoms, like fever, chills, loss of appetite, difficulty breathing or chest pain. If the cough is sufficiently severe to disturb your sleep and it cannot be controlled with otc anti-cough meds. There may be other parameters, but these should do ok for now.
Prolonged cough. Prolonged cough after a cold is common. Generally, if cough is the only symptom (no fever, no yucky sputum, no shortness of breath or wheezing), you can wait 2-6 weeks before seeing a doctor. After 4 weeks the kinds of things you should be concerned about are bronchospasm (treatable with an inhaler), atypical pneumonia, or pertussis (whooping cough).
When to see doc.. If the cough is lasting more than a couple of weeks or if it is accompanied by shortness of breath, or if it is worsening over time when other symptoms are getting better, then it is time to see a doctor. Certainly, any cough that lasts for 3 weeks or more needs an evaluation by your doctor.
It depends. If someone is older (over 50), smokes, has a history of COPD (chronic bronchitis of emphysema), has become more short-winded than usual, is coughing up blood, and/or experiencing fevers over 100 degrees for two or more days they should be seen by their doctor. Additionally, if someone is not sure whether cough requires a visit, it is better to have it checked to insure that it be properly treated.