Analyze the chord to determine the root of the chord. To do this, take the chord and rearrange the notes so that you can't fit any note in between any other note. For instance, the chord G E C, which is a C Major chord inverted in second position, would have to be rearranged to C E G, since you can place a C in between G and E, and you can place the G in between E and C. Thus, the reduction of this chord becomes C E G, or C Major.
Identify the note placed on the bottom. This will be the root of the chord, and you will want to place this note in the melody. In some instances, you can use other notes, if it provides better voice leading. For instance, in a chord with C E G, you may want to use a G in the melody if the next chord has an A as the root. The melody should move stepwise when possible.
Fill in the remaining notes of the melody by placing a chord tone from the chords into the melody part. As long as the notes in the melody land on the start of each new chord, your melody will fit with the chords. At this point, there should be one melody note per chord so that the chords and the melody move together.
Add additional notes to help give the melody more shape by adding passing notes between the chords. A passing note doesn't fit with any of the chord tones, but it works because passing tones occur in between the articulation of each chord. As long as each chord doesn't begin at the same time as a passing tone, the music will not sound dissonant.
Learn about the various types of non-harmonic notes to help enhance your melody. Appoggiaturas, anticipations and auxiliary tones are good places to start. These notes may be added in between the chords to make the music more interesting.