the topic about the race for the end-of-year number 1 has a thread on GM : So, which one will it be then? (Year-end #1)
As for the next weeks, Federer is guaranteed to stay number 1 until the end of Shanghai (299 weeks)
If he plays Shanghai and reaches the QFS there, he will keep the number 1 after Shanghai (302 weeks guaranteed until the end of Bercy as Djokovic hasn't entered Basel or Valencia). Moreover, Djokovic needs to win both Beijing and Shanghai to get the number 1 after Shanghai.
Then after Bercy, it will be the big moment when points from 2011 Basel and WTF drop, and probably points from Bercy 2011 drop as well. Which means this is about the Race to the year-end-number 1 and there's one thread about that (at the moment Djokovic is 1000 points ahead of Federer).