It's a combination of things. At shutdown, the Users profile data is
written to the disk. Windows must also stop/shutdown system type
of processes.In addition any background apps/watchdogs must be
stopped. Depending on what is running (TaskMgr,Processes) this
can be quick or in some cases quite long.
Microsoft has a Service Add-on, called User Hive Profile Cleanup.
This helps to fix several system event errors with shutdown. While
it won't necessarily speed up shutdown, it will help with stopping
the known problems with flushing profile data.
The first thing to do is examine the System and Application event
logs (Red icons indicate errors), these should all be resolved.
Next use MsConfig, to help determine what your PC is running that
may not be fully required.
Finally, (More advanced) Read up on Windows XP services. There
are many that start by default that aren't required. Unfortunately, the
list isn't fixed, because it's based on your specific hardware & apps.
http://www.blackviper.com/WinXP/servicecfg.htm
http://www.theeldergeek.com/services_guide.htm
As always, have a System Image Backup of your machine before
undertaking any type of Registry changes or modifying any Service
start modes.