If it's not shutting down with the software command, there is something in the memory that is hanging and not properly shutting down to let it continue the shutdown process. I bet if you tried shutting down after booting up in shutdown it'd shutdown fine.
If this is consistent open your task manager and see all running processes, take note of them to see if any seem odd or out of place. Open msconfig and go through your startup items, uncheck all of them, restart, try to restart again, it should work. If it doesn't move on to services. If it does, start enabling the startup items in msconfig one by one and restart twice (once to enable it to startup, once to see if it hangs) until it hangs again. Troubleshoot, remove, or reinstall that program.
Long process, but the only real way to figure out what's making it hang.
Also, I assume you're running windows. If you're running Mac OS or Linux let me know, I can help on either.