There is an application process that is hanging that is preventing your machine from shutting down. If you are forcing a shutdown, it may be corrupting system files. And, if you have not done so, you might also run a CHKDSK session on your drive to ensure you don't have file system corruption as well.
The next time it happens, try the following as it may or may not allow you to identify the application:
1) Hit cancel to return to the desktop
2) Go to the Windows Event Viewer, and view the application log. Sort the log by time/date decending
3) Check for an event that mentions something about an application attempting to veto the shutdown (it will use the word "veto"). It ought to be one of the first several events in the list that you see.
If you find an event saying this, the EXE file it points to is part of the software that is hanging. You can do a google search to see what software that EXE is a part of so you can try to remove or reinstall it.