Frozen Mouse: How Do You Shut Down a Mac Without a Mouse?

If your mouse freezes, but you still have control of the keyboard, and it is functioning (hint: see if COMMAND - TAB allows you to toggle among applications), you should be able to shut down you Mac with the following keyboard simultaneous commands ...

Command-Option-Control-Media Eject

The command should Quit all applications after giving you a chance to save changes to open documents, and then shut down the computer.