Find the app that's not responding (it'll say "Not Responding" to the right of the name), click on it and hit Force Quit. You should see the Force Quit Applications screen pop up with every app you're using listed within the menu.
If you look at the app in the toolbar at the bottom of your screen, it should no longer have a dot underneath it, signifying you've successfully exited. Find the unresponsive app from the Command column, copy the PID (located in the leftmost column) by highlighting and typing "Cmd + C." Open a new window in Terminal, type "Kill," hit the spacebar, and type "Cmd + C." A message along the lines of "Kill 93142" should pop up. Terminal displays your CPU and RAM usage diagnostics. Go to your Applications folder, scroll down to Utilities, and launch Terminal. You can find the Apple icon in the upper-left corner of your screen. Press "Option, Command, and Esc (Escape)" at the same time or choose Force Quit from the Apple menu.
HOW TO STOP IMAC SPINNING WHEEL NON RESPONSIVE MAC
Your Mac will verify that you really want to quit the process before exiting it. To find the Activity Monitor, click on the Spotlight icon (it's the magnifying glass icon on the top right of your screen) and type "Activity Monitor." You'll then be taken to a task manager window where you isolate the unresponsive app and click the Stop Sign button to quit. If the last few steps haven't solved your problem, you can open the Activity Monitor. Look through the list of options and select Force Quit. Press and hold the Option key and you'll see the Quit selection. Right-click (Ctrl-Click) on the app in your toolbar. Let's say Spotify is giving you a hard time.
Choose Quit from the app's menu or hit Command (⌘)-Q.
Before you escalate things and attempt to force quit, try to close the lagging Mac app normally.