Understanding it
Google mainly discovers pages by following links. The sitemap adds to that path: it flags recent, deep or poorly linked pages, and when they last changed.
Google says so itself: a well-linked, modest-sized site can do without one. A sitemap becomes useful for a large, new or poorly linked site, or one rich in videos and images.
It is declared in Search Console and in robots.txt, and should only list canonical, reachable pages meant to be indexed.
A concrete example
Illustrative example: a training catalogue
A training provider publishes new sessions every month, reachable only through an internal search engine. Google struggles to find them.
The site generates a sitemap updated with each release, declared in Search Console. The indexing report then shows which sessions are picked up.
The common mistake
Listing pages you do not want indexed
A sitemap holding noindex, redirected or broken pages sends mixed signals. Only list canonical pages meant to be indexed, and generate the file automatically so it stays current.