I've seen how this works when all travel is via the land border, so I'll guess it is the same when you mix land and air travel. You might want to consider that this is coming from some random person on the Internet, though, since the written rules for the US VWP are fuzzy about what they actually do and I'm only describing what I've seen.
When you enter the US you'll be given a 90 day stay starting from the day you first clear US immigration. Any subsequent travel from Canada inside that 90 days will be considered part of the same 90 day stay; at the land border you'll likely be waved through without getting out of your car.
If you subsequently enter the US after the first 90 days expires, or request a stay beyond the end of the original 90 days, the officer will need to make a decision about whether to grant you a new 90 day (or less) admission. At the land border this may involve going inside to secondary to fill out a paper I-94W, which will cost you US$6. Note that this decision is not a sure thing, it is at the discretion of the officer. If you have in fact spent most of the prior 90 days in Canada and the US travel looks like incidental side trips you'll likely be readmitted, but if it looks like travel to Canada was to extend what was primarily a US trip beyond what the VWP allows then you could be refused entry. They should have records of when you were actually present in the US during the 90 days but you might want to collect receipts to show that yourself in case they screw up.
So if you want to be perfectly safe you should try to keep all US travel inside a single 90 day period, or apply for a US B visa before you travel. If you really are spending most of your time in Canada, however, there is a fair chance they'll grant you a new VWP stay if you need it.