Know the key/basic chord progression, and play within it as the melody moves along. Simple as that.
The recipe for making up a piano rendition of a pop song:
Basic Chord/Key Progression + Ability to play melody by ear with few/0 mistakes + Creative movements within the current key
Basic music theory helps then - knowing your scales and chords and arpeggios and whatever.
Simple is good. Something that feels dead simple, like an arpeggio in the left hand while you play the melody in the right, sounds beautiful to most other listeners. And it should sound beautiful to you - when you realize how such a simple mechanism can yield such beautiful music.