How does the Drupal template engine work?
The Theming Guide is a good place to start.  Also the Theming Drupal 6 and 7 pages should be of some help to you (more specifically, How the Drupal theme system works).

Theming guide:


  This handbook is about customizing the look and feel of a Drupal site.
  We'll show you how you can modify the appearance of your Drupal site
  without requiring expert knowledge of programming. And if you wish to
  go further, we cover that too.
  
  This guide assumes some knowledge of HTML and CSS but no PHP
  programming knowledge is necessary. It also assumes you have
  administrator's privileges to a Drupal site. You might also want to
  familiarize yourself with some of the terminology used in Drupal. We
  concentrate on Drupal 7 with notes for Drupal 6 where applicable.


How the Drupal theme system works:


  Pages in this section describe the way the Drupal theme system
  operates, theme components and settings, .info files and page
  templates. This section is a starting point for creating a new custom
  theme.