Melody is the tune of the music. Y'know, like the tune that you might find yourself or someone else humming while walking down the street or the corridor of the office where you work or the hallway of your school.
Usually, it's put "on top" of harmony
to form a texture of music called homophony. This style of music—melody on top of harmony—is probably the most common style of western music these days, and has been for the last few hundred years. By being on top we mean that its range of pitches
is higher—the notes that make up the melody are usually higher than the notes that make up the harmony. But not always.
When you have multiple instruments (including voices, possibly) playing at the same time, it's common to see one instrument playing the melody and the other instruments accompanying it, playing the harmony and embellishing that. This basically happens in every band.
Examples are all over the place, so no need to list them. Really, just pick up any pop song and listen to what's being sung. That's the melody.
When you have multiple melodies going at the same time that somehow fit together and kinda interact with each other, that's called counterpoint
, and the result is texture called polyphony.
Note that melodically-interesting lines need not be at the top of the texture. Sometimes, the melody is in the bass.