Question: To all the people with good ears:

when you're figuring out a melody by ear, are you listening to the sequence of notes and figuring out where each note sits relative to the root of the key?  

Or are you figuring out what the next note is by the interval from the last note?

Answer: 
As someone with absolute pitch, when I sit down and transcribe a piece or melody by ear, I determine each note individually by ear regardless of whether the piece is atonal or not or what the note intervals are.

Whoops.

For particularly hard-to-hear notes, though, I do fall back to intervals.

(As an aside, I often sing music by pitch-matching my singing to the (however flawed) recording in my head, which depends neither on keys nor intervals. Bizarrely, I am often aware of the key(s) (if any) of an excerpt I listen to for the first time before I am aware of what each individual note is.)
When playing by ear (or writing things down), I have a lot of mental scaffoldings in my head. Like a set of automatons working in parallel, each making sense of something else:

* relative intervals to the last sound
* relative interval to some sound I remember / can relate (e.g. when I play a 6 note motive I hear that the last note is fifth below the first one)
* possibilities of the current scale
* interval relative to bass
* typical harmonic behavior, like resolving dominant 3 or dominant seven (the longer one plays, the more behaviors they consider "typical")

Some of those automatons are more cerebral, and some work on the finger level (even when I am not playing an instrument and just jolting down notes, I actually move my fingers).

When I play "by ear", I see a set of "green lights" in my head: the automatons all confirm each other's choices. It's like: "OK, the next sound is a minor second below... check; it's minor seventh of a minor chord resolving to major third of a dominant... check; it is the seventh tone of the current scale... check; base jumps a perfect fourth up... check; it's the same sound we heard on the beginning of the phrase... check". Sometimes it happens that one of the machines says: "bzzzt! something's wrong!", and then a frantic voting happens, I have to take things off the auto pilot and fall back to 1 (just relative intervals).