I first make sure I know the melody well, then I look up the suggested chords, then I find the chord voicings that allow me to play the melody in the chords. For example a melody might go from G to Bb in a Cmaj chord (ie C to C7), and I might want it to come in a high range. I could use the xx5558 version, going to xx5556. If I wanted in the low range, I could use the open chords, x32010 to x32310.

An example is the second line of "House of the rising sun" - "They call the rising sun", Am, C, E7. I play it 002210, 8x558x, x8786x to catch the melody in the high notes - and variations around that.

I sometimes change the suggested chords to make the melody fit more easily.
A good deal of music theory. That's really all I can tell you, if you know how to make chords then it's just a matter of putting them with the melody.