After a failed install or a .deb installed with plain dpkg -i, apt can refuse to do anything else until the dependency mess is fixed. Two commands sort that out.
First check what is wrong:
sudo apt-get check
It reads the package database and reports broken dependencies without changing anything. On a healthy system it prints only the usual reading lines and exits quietly.
Then let apt fix it, but simulate first:
sudo apt-get -s -f install
sudo apt-get -f install
-f, or --fix-broken, tells apt to correct the system in place. Without package names it tries to install the missing dependencies, or, if that can’t work, to remove the package that causes the problem. That’s why I’d read the simulation before agreeing.
The typical case is dpkg -i some-tool.deb, which installs the file but doesn’t fetch dependencies. apt-get -f install then pulls in what’s missing. Using apt install ./some-tool.deb from the start avoids the whole thing.
Be careful when the plan includes removals. If apt wants to remove half your system, something bigger is wrong, like mixed repositories from two releases. Stop there and look at apt policy for the packages involved, instead of saying yes and hoping.
Further reading: apt-get(8) manual page