The file follows the sitemaps.org schema — a <urlset> with one <url> entry per page, each with <loc>, optional <lastmod>, <changefreq>, and <priority>. Small sites use one sitemap.xml; large sites use a sitemap index that points at several.
Search Console lets you submit the sitemap directly; robots.txt can also list it with a 'Sitemap:' directive. Both are useful — Search Console gives you a coverage report per URL.
Only include URLs that return 200, have a self-referencing canonical tag, and are meant to rank. Don't list redirects, 404s, or noindex pages.