The melody line of a song is typically made up of the major scale. Their are 12 major scales (well, technically 15) The major scale consists of 7 notes. 95% of the time, the melody line lies within those seven notes. Use your ear to determine whether the melody line is going high or low and adjust accordingly on the piano.
See if you can figure out "mary had a little lamb" using the C major scale. C D E F G A B (hint: 1st note starts on E)