In Maine and Nebraska, how are the district votes decided?
Is it by whoever wins the House race or by whichever presidential candidate gets the most votes in the district?
Typically (perhaps universally in 2004?), the name of the elector candidates do not appear on the ballot, but rather the name of the Presidential and Vice Presidential candidates. State law then prescribes how votes cast for the Presidential/Vice Presidential ticket determine who the electors are.
Below are urls of the certificates of ascertainment for Maine and Nebraska (plus Missouri and Texas). Note that for Maine and Nebraska, the sum of the district votes for a candidate is equal to the number of statewide votes. Each ballot in effect gets counted twice (in practice they are counted once and added into two different sums).
If you read the Maine certificate closely, you will notice it is the electors who receive the votes. That is, Jill Duson was chosen as the elector for the 1st District, because she received more votes than the other elector candidates. A vote for Kerry-Edwards was a vote for Duson.
Missouri also chooses its electors by congressional district, with two at large. However, the elector who is chosen in each district is based on the statewide vote for the president and vice president candidate. Again, it is the elector candidates who are credited with the votes cast by the voters.
I've included the Texas certificate because it is explicit about the conversion of votes. The electors are numbered, but this is merely a sequence number.
Maine Certificate of AscertainmentMissouri Certificate of AscertainmentNebraska Certificate of AscertainmentTexas Certificate of Ascertainment