Windows XP checks for some hardware changes, including display card, RAM size, CPU, disk, etc. If the hardware changes are small (to my understanding, less than three changes) Windows XP will not require reactivate, but it does reset the timer. Basically you need to have a long period of time without changing any hardware to be able to use internet to re-activate.
[EDIT] Some said that retail version of Vista only allows 5 times activation through internet, and all further re-activation will require phone-in. I'm not sure about Windows XP though. I've only dealt with OEM version Windows XP.
When you reformat and reinstall you always have to activate windows, every time. It doesn't matter if you change some or no hardware. The question is whether you can do it online or by phone. My experience is I have to do it by phone now always on two of my licenses, and the other still works. I have a vista 32bit version, but haven't done anything yet with it in regards to reactiving.