For me one of two ways works. Most often I start designing a patch on one of my synths and that ends up becoming a full song. Other times I start by noodling on the piano or organ and ending up with something I like. I suspect the more musically gifted do the latter more often, while the more technical ones like the process of patch creation, etc.
I evolved this way, though I'm far from gifted. Starting out, anything I made was driven by whatever sounds I was noodling with. Now, I almost start on the piano, compose the outline, and then pick the sounds that I think fit it.
The first approach has a sense of creative wonder to it, where your being guided by an outsider. As much fun as that is, it is very limiting and I suspect most people abandon that approach as their skill improves.