Overview
echo prints its arguments, separated by single spaces, and ends with a newline. It is the simplest way to show a message or to put a known line into a pipe or a file. Every shell has its own echo builtin, and there is also an /bin/echo program; they agree on plain text and disagree on options and on backslashes, which is why printf is safer for anything but plain text.
Background
The macOS manual for echo says the utility conforms to POSIX, whose specification leaves option handling and backslash escapes to the implementation. Today the name covers the Bash builtin, GNU echo, the echo that macOS ships, and the echo applet in BusyBox. They agree on printing the arguments and a newline.
Examples
Print a word:
echo hello
Print several words; the arguments are joined with single spaces:
echo one two
Keep extra spaces by quoting the text:
echo "a b"
Print the result of an arithmetic expression:
echo "$((1 + 2))"
Write a line to a file and read it back:
echo hi > out.txt && cat out.txt
Print an empty line by giving no arguments:
echo
Common mistakes
Without quotes, the shell splits and expands the text first, so echo * prints the file names and extra spaces vanish. -n (no newline) and -e (interpret backslashes) are not portable: the builtin of a given shell, GNU echo and macOS /bin/echo treat them differently, and some print -n as text. Use printf for anything with backslashes, no newline or a leading dash. echo cannot reliably print text that starts with -.
Portability
Only plain arguments, quoting and redirection are in the Common examples, which gave the same output in the Bash builtin, GNU echo, macOS /bin/echo and BusyBox echo. In a plain sh script the builtin may behave differently from both Bash and the executable; the macOS /bin/sh, for example, printed -n as text for echo -n in the check. The Common examples were executed on Bash 5.2, GNU coreutils 9.11, macOS system tools, and BusyBox 1.37.0 (see the development guide for the exact check).
About BusyBox echo
BusyBox bundles echo as an applet, and anything beyond the common options depends on how it was built. This page's examples ran on BusyBox 1.37.0.
BusyBox notes
BusyBox echo prints its arguments and a newline. Its -n, -e and -E options depend on the build.
References
Original explanations, with upstream documentation for further reading. FreeBSD references are comparison material, not a claim of Apple version equivalence.