Fig 1. (a) A descending scale in the Ionian (major) mode, which by itself evokes no particular song. (b) The same a ssequence of pitches set to a particular rhythm is immediately recognized as Joy To the World.
A melody is a sequential (one after another) arrangement of notes in a rhythmically and tonally aesthetic way. The succession of notes comprising a melody is perceived in the mind as a unity. For much of the history of music there was only melody and rhythm. Harmony is a more recent and almost exclusively Western development.
Until about AD 900 all music was melodic, i.e. consisted of merely one "line" of notes, so that if dozens of people were singing together they did so in unison (or octaves if there were men and women or children). Much non-Western music remains purely melodic, as does European folk song and plain-song. Many apparently simple folk melodies, however, are highly organized as regards the use of different pitch levels of some simple brief motif, the use of a high note as a point of climax, and so on; many such melodies are cast in some definite form, as for instance, simple ternary form.
Rhythm is an important element in melody, whether it's the prose rhythm of primitive music, plainsong, and the compositions of some modern-composers, or the metrical rhythm of most music. In fact this element is so much a governing factor in the effect of a melody that if the notes of a well-known melody are left intact but the rhythm is drastically altered it becomes difficult to recognize the melody.
Once harmony had become an element in music in began to influence melody in this way – that melodic passages are often found to be based on the notes of a chord (with or without added decorative or intermediate notes).
The quality of originality in melody is hard to pin down. Seemingly it lies in mere detail, since, looked at critically, what we accept as an original melody is often found closely to resemble some previous and quite well-known melody. What makes a melody popular and long-lived is hard to say, an important factor is logical organization – a quality the value of which, apparently, the mind subconsciously recognizes.