There are any number of reasons why shutdown problems arise. Worse still is the number of occasions when shut down takes forever. Bear in mind that Windows has to shut down everything that is loaded, including a large amount of file re-writes as part of the shut down process - you could find that your successful shutdowns coincide with shorter switched on times (like when you took the PC back to the shop??).
When was the last time you defragged your HD.
I had a 98SE system which took over 4 minutes to shut down when I installed DirectX 8.0, and I could only resolve the problem by a complete re-installation of Windows, which reduced the shutdown time to less than 20 seconds. If all else fails, this could be the time for you to restart