Most shutdown problems are fixed in Windows updates or Service Packs, so check you're up-to-date before troubleshooting. Then try to identify what exactly causes Windows to hang; if you can find a process or program, close it manually (using Task Manager if necessary) to verify it's the culprit, then search the web for a possible fix or update.
If it starts with Windows, disable it. If you can't identify the culprit, visit http://support.microsoft.com/kb/308029for an advanced guide; the instructions are written for XP, but many can be applied to Vista and Windows 7 too.