404 (Not Found) and 410 (Gone) are HTTP status codes reporting that there is no page at an address. A 404 only says the server cannot find anything. A 410 says the page was removed deliberately and for good. In practice Google makes no distinction: all 4xx codes except 429 are treated the same way. The URL is not indexed, and a previously indexed URL drops out over time.
When do you use them?
For content that is truly gone and has no successor. For a site move, Google advises returning a 404 or 410 for old content you are not carrying over. If a page does have a successor, use a 301 redirect.
Example
Say a bike shop permanently stops selling a brand. The product pages for that brand have no suitable replacement. A 410 at those addresses is honest towards visitors and clear to search engines. A tidy error page with a link to the rest of the range helps the visitor on their way.
Common mistake
Sending all removed pages to the homepage, or showing an error page that technically returns a 200. The second is called a soft 404 and keeps getting crawled. More on removed pages during a redesign in Redesigning your website without losing search visibility.