How does apt-get really work?

Okay, I understand how I may use apt-get {install|remove} mypackages and apt-get upgrade to install, upgrade, or remove binaries as well as their configuration data files and dependencies (actually, remove will only remove the binaries unless additional flags are provided).