What a sitemap is for
A sitemap is a discovery aid, not a ranking factor. It lists URLs you consider worth crawling, which helps search engines find pages that are poorly linked internally, newly published, or otherwise hard to reach by following links. Submitting one does not cause pages to rank, and does not guarantee they will be indexed.
It matters most for large sites, sites with deep hierarchies, sites with few external links, and pages that are genuinely orphaned. For a small, well-linked site, a sitemap adds little — crawlers will find everything by following navigation anyway.
Because inclusion is a signal about quality as well as existence, the file should list only canonical, indexable URLs that return 200. Listing redirects, 404s, pages blocked by robots.txt or non-canonical duplicates sends contradictory instructions and dilutes the file's usefulness.
Limits, structure and the optional fields
The specification caps a single sitemap at 50,000 URLs and 50 MB uncompressed. Beyond that you need multiple files referenced from a sitemap index, which is itself a small XML document listing the sitemaps. Files may be gzipped, and the limits apply to the uncompressed size.
Of the optional elements, only <lastmod> carries real weight, and only if it is accurate. Google has said it uses it when it is trustworthy, which means reflecting genuine content changes — a build process that stamps today's date on every URL at every deploy makes the field meaningless and it will be ignored.
<changefreq> and <priority> are effectively ignored by Google. Priority is relative within your own site rather than a competitive signal, and setting everything to 1.0 conveys nothing. They are harmless to include and pointless to agonise over.
Submitting and keeping it accurate
Two mechanisms exist. A Sitemap: line in robots.txt with an absolute URL is discovered automatically by all major engines and requires no account. Submitting through Google Search Console and Bing Webmaster Tools additionally gives you reporting — how many URLs were discovered, how many indexed, and which were excluded and why. That report is the most useful part, because "discovered but not indexed" is a signal about content quality rather than a technical fault.
URLs must be absolute, must use the same protocol and host as the sitemap itself, and must be properly XML-escaped — an unescaped ampersand in a query string invalidates the whole document. The file must sit at or above the directory level of the URLs it lists.
Keep it current. A sitemap regenerated automatically on deploy stays accurate; one maintained by hand drifts, and a file full of stale URLs is worse than none. Pair it with a robots.txt that points to it.