Jules, I'm no expert in this.....so hopefully someone else will chime in and give you a better explanation or techinque. With that disclaimer out of the way....here's what I do!
Use the pen tool to draw your line. (If it's a straight line that's no biggie...curved lines are a little tougher.) Make sure you have the pen tool set for Paths (third icon from the left at the top menu bar) If you want a straight line, click where you want the line to begin and then hold down the Shift key before clicking where you want it to end.
Now open you Paths Palette and you should see a "work path."
Now choose a brush.....ie. a hard round brush for a dotted line.....you'll want to open your Brushes Palette and adjust the spacing of the brush to taste. (increase it)
Switch back to the Paths Palette and choose the second icon from the left on the bottom (Stroke Path with Brush)
Hope this helps!