I can, sort of, improvise a song. My method includes music theory and chord progressions.
I choose a chord progression; C F G C for example.
I follow a rhythm
My left hand plays the root note.
My right hand experiments.
voila insta-song.
Some notes:
Chord progressions can really complicated or incredibly simple.
My left hand can play chords, arpeggios, or just a single note. As long as each note fits into the chord, and the root note is at the bottom, it should be fine.
My right hand plays a melody. Usually this melody goes into the next chord. Say my melody starts on C and goes to F, I can play any notes in a measure, barring accidentals, as long as when the chord changes I am either playing the note of the chord, or not playing anything.
I can stay on a single chord for a long time, it doesn't matter when I change it. Experiment with this.
Experiment! Nothing I said is set in stone.
Yes improvising takes practice, but it can sound decent if you follow a progression.