If a Mac running OS X appears to be stuck, then unless you have disconnected something inappropriately, it almost certain to be just the display that is frozen, not the system itself. It is almost always possible to log into the computer from another one. Once logged in, if you are an administrator, it is possible to forcibly log out the user or to reboot.
Open a window in Terminal (or in a Windows equivalent like PuTTY then enter:
ssh your_username@the.name.of.the.frozen.computer
For example:
ssh admin@mylab.mcmaster.ca
If asked to accept the computer's identity, enter:
yes
When asked, enter your password.
Next, to log somebody out enter one of these:
sudo killall WindowServer
(for OS 10.5 or 10.3)
sudo killall loginwindow
(for OS 10.4)
Or to reboot the computer enter:
sudo reboot
Finally, when asked again, enter your password.
You will know it worked because you will be disconnected. Note that if the computer has been having problems, it may take a long time to log out or to restart, perhaps as long as 20 minutes.