Event Viewer may highlight the problem, as suggested by Argee. Often the event description isn't too helpful though.
Using a system restore point, as suggested by SlimJim is the easiest way of dropping back to a previous point just to see if it fixes the problem.
The backup program exists somewhere on the XP CD (can't remember where off the top), but it's easy to obtain and install.
A couple of other things worth trying, but create a system restore point first...
Close down each application you are using one at a time, and give them time to terminate properly.
Does it happen on all user accounts? If it only happens on yours then it may be to do with an application you are running or your user account and/or profile. For a start ditch all the stuff you don't have to run. It's amazing the amount of 'free' utilities that people run!
Other than that it may be a user account or user profile problem. Every time you create a user account it will have its own unique profile associated with it. This contains many of the basic settings used by the account, and all the tweaks users apply as the account ages. You can test this by creating a new user account which will have its own user profile.
If it looks like your user profile is causing the problem you can create a new one without creating a new user account for yourself if required. In essence you log on to a different account to the one you're having trouble with (you can't do this from the suspect account), then rename the profile of the troublesome account. The profile is in 'C:\Documents and Settings\' and will have the same name as the account. Take careful note of the name of the profile, then rename it. Now log on to the suspect account, and a new profile will be generated for you. See if the shutdown problem still exists then. If it does, then you have to reverse the above procedure to re-instate the old profile. If it doesn't then you can copy many of your original settings (e.g. Favourites, desktop items etc) back from the old profile you renamed earlier, or roll back to the restore point you took at the beginning. I've had to do this plenty of times when working in the IT industry, and the info is offered in good faith, but please call on a local support person if you're not familiar with the way these things work.
I don't recommend hacking around manually in the registry unless you're sure what you're doing.
Good luck!