A product photo on a white background, a logo on a colored square, a headshot for a profile page: often you only want the subject. Preview on the Mac can lift it out in one click.
Open the image in Preview and click the Remove Background button in the toolbar.
Open image in Preview
Click Remove Background
Convert to PNG? > Cancel, then File > Duplicate (keeps the original)
Preview may ask whether to convert the file to PNG. That’s because a JPEG can’t store transparency. Apple’s guide gives two choices: click Convert to change the original, or click Cancel and choose File > Duplicate to work on a copy. I’d always take the copy route, so the original photo stays untouched.
It works best on a clear subject against a calmer background: a person, a mug, a pet. A busy street scene can leave bits behind or cut off something you wanted. Edit > Undo brings the background back if the result is off.
When you only need part of a picture, there’s a manual version too: under the selection tools in the Markup toolbar you can trace the edge of what you want and copy it with Edit > Copy. Apple’s example is lifting one face out of a group photo.
For a PDF, export the page as an image first; Apple notes the image tools don’t work on a PDF page directly.
Further reading: Remove a background or extract an image in Preview on Mac (Apple)