Overview
rm deletes the files you name. It does not move them to a trash, so a deleted file is gone. Directories need -r.
Background
An rm command appeared in Version 1 Unix, according to the FreeBSD and macOS manuals. Today the name covers GNU rm, the rm that macOS ships, and the rm applet in BusyBox. They agree on -r and -f, and differ on interactive -i, verbose -v, and the empty-directory option -d.
Examples
Delete one file and list what is left:
rm app.log && ls
Delete several files:
rm app.log notes.txt && ls
Delete a directory and everything inside it:
rm -r logs && ls
Ignore a file that does not exist, with no error and a zero exit status:
rm -f missing.txt && echo done
Options
-r
Remove directories and their contents recursively. -R is accepted too.
-f
Never prompt, and do not complain about files that do not exist.
Common mistakes
There is no undo. Check a pattern with ls before you pass it to rm, quote or escape names that contain spaces, and be careful with variables that may be empty: rm -rf $DIR/ with an empty DIR aims at /. Use -- before names that start with a dash, as in rm -- -file.
Portability
Only -r and -f are in the Common examples. Interactive -i, verbose -v and the empty-directory option -d behave differently or are missing between implementations. The Common examples were executed on GNU coreutils 9.11, macOS system tools, and BusyBox 1.37.0 (see the development guide for the exact check).
About macOS rm
This is the rm in /bin on macOS. It also accepts -I, and adds -P to overwrite files before deleting and -W to undelete on file systems that support it, which GNU does not have.
Apple notes
macOS rm is the BSD implementation. It also accepts -I, and adds -P to overwrite files before deleting and -W to undelete on file systems that support it, which GNU does not have.
References
Original explanations, with upstream documentation for further reading. FreeBSD references are comparison material, not a claim of Apple version equivalence.