To harmonize a melody, you simply play a chord which contains a note from that melody on the first beat of each bar. In * time, you could also add another chord on the third beat of the bar. There is always more than one chord which could be used, but some sound better than others. The more songs you learn and analyze, the easier it becomes to find the right chords to play. If you analyze the primary chords in C major, you will notice that the notes C and G appear in two chords. This means that when harmonizing a melody in the key of C, you could try both chords wherever one of these notes appear on the first beat of a bar. The following example shows a melody in C major harmonized with chords I, IV and V .
Once you are happy with the basic chords, you can use them to create a more interesting accompaniment. Here the left hand plays a pattern using the root and 5th of each chord.
You could also add extra harmony notes using voice parts, as well as adding some responses to the melody, or bass runs. Experiment with different approaches to harmonizing other melodies you know. The more you do it, the easier it gets.