hey currawong, yes thanks for reminding me. I find playing by ear and improvising go hand in hand.
This is my step by step to playing a song by ear: Let's take a simple song like "Row row row your boat"
1) First decide what key you are going to play it in. Usually you can tell if it's major or minor, or if it modulates. Let's pick C major.
2) Play the tonic of the key, which is C. SING the melody of the song in that key. Figure out which is the starting note. For "row row row..." it would be the tonic.
3) Just play the right hand melody and sing aloud while you play. This burns the melody into your mind.
4) Now add the harmony. Depending on the level of the player, start with the basic chords. 1, 4, 5.
Use your ear to determine which chord. You will make some mistakes, no problem, let your ear guide you.
This method works for ANY song. I taught a 12 year old girl how to play "row row row..." in my first lesson, and she'd never played by ear before.
As long as you break it down and simplify the process, most kids will get it. Singing aloud is important, as it reinforces the note in your mind while playing.
I've used this method for much harder jazz songs. Say a ballad like Only the Lonely by Frank Sinatra: http://www.youtube.com/watch?v=4Pyqs4FvkyY
It is based in C major but uses all the blues notes, b3, b5, b7. So the harmony has to match accordingly.
I'll play the melody separately first about 10-20 times, even in octaves. Then I work on harmony.
For jazz, you can improvise and do all sorts of neat things. Tritone subs, playing "outside" the key, melodic minor modes, secondary dominants, altered chords, sus chords. All just fancy names that mean you are using different or non-diatonic notes from the key.
If you listen to Keith Jarrett play ballads, (he's the master) he'll incorporate many of these things. Listen to his rendition of Somewhere Over the Rainbow.
For any key, really all 12 notes are available to use and in the proper context will sound great.
I'd love to post some of my playing as sounds really are the best way to explain, alas I don't have a digital recording device at the moment.