you want to rack the beer into the secondary when fermentation is basically complete. A *fast* fermentation might take 2 days, but I would say that most people see fermentation complete within 5 to 10 days.
One way to estimate this is to watch the bubbles in the hydrometer. They will slowly taper off as it nears the end of fermentation.
Another thing a lot of people do is wait for the kraeusen (the foam that formed during fermentation) to collapse back into the beer and vanish.
The only way to know EXACLTY when to rack it is to have the knowledge of what the final gravity of the finished beer is supposed to be, and then use your hydroemeter to take readings and see if it has hit that number.
The point of racking the beer into a new fermenter is to get the beer away from the sediment that will have formed in the primary fermenter. It's mainly hops residue, protiens, and yeast. You don't want/need any of this stuff anymore.
After racking, you'll want to let the beer mature and mellow out in the secondary fermenter. The beer will continue to drop sediment in the secondary, and the clarity will greatly improve.
Then you bottle it up, let it age a while longer to carbonate and mature
further.
Mmmmmmm.... beer.
As a rule of thumb (*), the "1-2-3" schedule is a decent guide.
1 week in the primary
2 weeks in the secondary
3 weeks in the bottle
drink
I will admit that I usually get end up with a 1-2-2 schedule because I am impatient.
-walker
(*): a rule of thumb is a rule that it always true, except for the times that it isn't.