You can restart your Mac, when it got frozen, follow the simple steps below
Find the power button. On an iMac it is found on the back of the computer near the left bottom corner. For a MacBook Pro, it is on the right speaker. On a MacBook, the power button is at the top right corner of the base, near the screen. If you’re using a MiniMac, it is on the back, near the top right corner. Last but not least, the power button for a Mac Pro is on the front.
Press and hold this button for 5 seconds, and the computer will shut down.
Restart your Mac by pressing the power button again and releasing it quickly. If it doesn’t restart, try again after a brief wait.
If it still not restarting, you will need to troubleshoot other possibilities but two good things to check are a) power supply (you might have knocked it out accidentally while turning the computer off) or b) a dead battery could be the cause of the freezing and then not coming back on again. If it’s still doesn’t work take it to a repair shop or buy a new laptop.
Note
This is especially useful if you run OS X off a server, and it can freeze easily.
This forces a shutdown of your computer, and any unsaved work will be lost, and any important activities will stop.