The Three Finger Salute - Force Quit
It's called "The Three Finger Salute" on a Windows machine, and is probably the first thing a Windows user learns. It is a way to force an errant application to close when it has "frozen" and you don't seem to be able to go anywhere. Pressing the CTRL+ALT+Delete keys at the same time will bring up the Windows Task Manager and allow you to close the application in question.
When you have a misbehaving app on a Mac, Ctrl+Alt+Delete doesn't do a thing, but if you press Command+Option+Esc keys at the same time, you can use the Force Quit option to close whatever is giving you grief. Once you have it open, you can scroll down to the app that is not responding, click it, then click the Force Quit button.
This should work even if a misbehaving application has taken over your screen and your Mac isn't responding to other keyboard or mouse actions. If this fails though, you are more likely to need to do a "rude shutdown" on your machine and forcibly restart your Mac. To do this, press the Power button and hold it for several seconds. Only do this as a last resort, if your Mac can't be shut down normally.
Another Way
If you can't remember the Three Finger Salute, there is another way to get to the Force Quit dialog box. Click the Apple icon at the top left of your screen (once left mouse button) and you will see other choices. One of those choices is (wait for it...) Force Quit! Don't you just LOVE it! This will specifically name the current application you are working with, or it may just say Force Quit. Click the words once with your left mouse button and either the "stuck" application will close or the Force Quit dialog box will open and you can choose the app you want to close there.
Either way, you can't lose.