Ah, "flow". The experience, of course, has always happened to me, ever since I started playing the piano. There are times when I'm "in the mood" and all sorts of ideas happen naturally on the piano, in a manner more satisfying than even a performance of some hard classical piece. But there are other times when I'm just not in the mood.
I think this is what the jazz musicians call "swing". Swing, I realize, is not actually the rhythmic feel - it is more the impulse to improvise, the "groove", so to speak, to start making the music come out in a spontaneous outburst of creative inspiration.
For me, one thing that helped me enter "flow" was to record myself playing an accompaniment part for, say some popular song - and then I would play the recording 2 or 3 times while I improvised on it. After that I could do SO MANY things with practically any theme.
Don't get me wrong, however - I'm no professional improviser/jazz pianist.
I think there must be a psychological term for this, the "subconscious", maybe. Because if I'm not mistaken, it is in this state, when the "consciousness" barriers are off, when creativity begins to unfold. This is where the artist gets inspiration.