After you type your password once, sudo remembers it for a while. That is convenient until you leave a terminal open on a shared or unlocked machine.
You can drop the cache yourself:
sudo -k
According to the sudo manual, without a command it invalidates your cached credentials for the current session, and the next sudo asks for the password again. It does not need a password itself. The manual says it was added so a user could revoke sudo permissions from a .logout file. The capital version goes further:
sudo -K
That removes every cached credential for your user, regardless of terminal or parent process ID, and it cannot be combined with a command. The opposite exists as well. sudo -v updates the cached credentials and asks for the password if needed, which extends the timeout without running a command. That is handy before a long script that calls sudo several times.
Used with a command, -k does something different, and the manual spells it out: sudo ignores the cached credentials, asks for the password, and does not update the cache.
sudo -k ls /root
By default the sudoers policy caches credentials for 5 minutes, with a separate record for each terminal, so sudo -k in one terminal leaves the others alone. The timestamp_timeout and timestamp_type options in sudoers(5) control that, and your machine may be set up differently.
The caveat: this only affects sudo’s cache. A root shell you started earlier with sudo -i keeps running, so close that separately.
Further reading: sudo manual