In Plain English
A robots.txt file normally sits at the root of a domain and tells compliant crawlers which paths they may or may not request. Rules can allow or disallow crawling, and the file can declare sitemap locations. Blocking a path changes crawler access; it is not a reliable way to remove an already known URL from an index. Because the file is public and voluntary, sensitive content needs real authentication and access control instead.
Why it matters
A careful file can steer crawler activity away from unhelpful areas. A broad accidental block, however, can prevent important pages and resources from being crawled.
Rules are evaluated by crawler and path, so a small punctuation or grouping mistake can have wide effects. Test important URLs against the deployed file and review it after platform or domain changes. Allowing crawling does not promise that a URL will be crawled, just as disallowing a path does not erase knowledge of that address. When removal is required, choose an appropriate index-control or access method rather than treating every problem as a crawl rule.
Example
Example domain and path only:
User-agent: *
Disallow: /private-preview/
Sitemap: https://example.com/sitemap-index.xml
Common misunderstanding
robots.txt is not password protection and is not equivalent to noindex. One controls compliant crawling; the other requests exclusion from an index.