There are three keyboard shortcuts for taking screenshots on a Mac:
It captures a screenshot of your entire screen.
It turns the cursor into a crosshair, which you can drag to select a portion of your screen to capture. Release the mouse button or trackpad to take the shot.
3. Command-Shift-4, then space bar, then click on a window
Hitting the space bar turns the crosshair into a little camera icon, which you can move over any open window. Click on your desired window to take a screenshot of it. A screenshot captured by this method features a white border around the window with a bit of a drop shadow.