How does dpkg install a package?

You can read the various Debian documentation:

  • Debian New Maintainers' Guide - intended at new package maintainers like yourself. (PDF here.)
  • Debian FAQ:
    1. Package management basics.
    2. Package management tools.

At a simple level, dpkg checks to see if dependencies/conflicts are met, extracts the files from the .deb file, runs any {pre,post}{inst,rm} scripts (whichever are applicable), and adds a record that the package is installed into its records (which is just a file, I think).