The USTA does not disclose the exact algorithm, but does offer quite a bit of information on how it works in various documents and FAQs that you can find on the USTA web-site(s) or by Googling around.
And dizzy is generally correct about always playing with the same partner preserving the gap between the partners no matter what the scores are. But if one partner plays even one match by themselves or with a different partner, this isn't true as that would likely change their rating and one of the past 3 ratings that is part of the average is now different between the partners so the gap between them would change.
To andfor's question, what your opponents from this week do the following week has no impact on your rating unless you happen to play them again the future or they become a benchmark player which would mean year-end benchmark calculations will factor in for your match against them at the end of the year.
See my blog at http://computerratings.blogspot.com/search/label/tennis
for some posts on this subject and a description of the Estimated Dynamic NTRP reports I can generate.