find . -name *.txt without quotes often works. That’s the dangerous part, because sometimes it quietly searches for something else.
The shell expands wildcards before find even starts. If the current folder has no .txt files, the pattern stays as it is and find gets *.txt. If it has exactly one, say notes.txt, the shell replaces the pattern and find searches only for files called notes.txt. With two or more, find gets extra words and stops with an error. Mine said:
find: paths must precede expression: `x.txt'
find: possible unquoted pattern after predicate `-name'?
The middle case is the bad one: no error, just a wrong result that depends on which folder you happen to be in. The fix is quotes, every time:
find . -name '*.txt'
Single quotes are the safest, because the shell leaves everything inside alone. Escaping the star with \*.txt works too, but I find it easier to forget.
The same goes for -path, -iname and -regex, and for -exec arguments that contain wildcards. zsh users get an error like “no matches found” when the pattern matches nothing, which at least makes the problem visible.
Further reading: find(1) manual page, GNU findutils manual