Most people reach for wc -l to count lines, and that is the right call. Still, sed can do it too, and the trick is a nice way to see how sed addresses work.
Try this:
sed -n '$=' access.log
$ is the address of the last line, and = is the command that prints the current line number. -n turns off the normal printing of every line, so you get one number and nothing else. Put a pattern in front to count only matching lines, as in sed -n '/error/=' app.log, which prints the line number of every match instead.
A caveat: if the file has no trailing newline, wc -l and sed can differ by one. For a simple total, wc -l is shorter. The sed form pays off once you combine it with an address, because it can print the line numbers of matches for you.
One more detail: the same address trick prints the last line only with sed -n '$p'. Together with = it shows that sed commands are small building blocks, and addresses decide which lines they act on.
Further reading: GNU sed manual, = command