Melody is a music element = tune or line. It is the horizontal dimension of music.
Melody is what we can sing. In fact, singing and the voice is the link to playing melodies on instruments. If you can sing it, you can play it. If you can’t sing it, it ain’t musical.
In a melody, tones can stay the same, go up or down. That’s it. When tones move up or down, the questions are “how far?” and “what’s the interval?”.
Rhythm is also a factor. If the rhythm isn’t the way a tune is played, or is too extreme of a variation, listeners may not be able to recognize it. Everyone can recognize melodies (twinkle or other cultural songs, melodies in songs, in general). If we played them in radical rhythms, they may not.
Melody is one of the musical elements which can be copyrighted.