There are many techniques for this as there are people. Some people take a tune from one place and lyrics from another and almost force them together, like a shotgun marriage. Others have one person who is the tunesmith and the other who is the lyricist, and they collaborate.
Others go through a number of different creative games. They’ll impose a structure and force people to work within that structure in order to create. Others will just jam and jam and record it all and look through it later to see what can be used. I’m barely touching the tip of the iceberg here.
I suggest you start working with other people. It means imposing structure on yourself that you would otherwise hate to do. Most people might think it would cramp their style, but if you are open to it, it has quite the opposite effect. Establishing structure or rules can actually open up creativity in a way that having total freedom cannot
So you might try this. Write out the meter of your words. Put it into a rhythmic beat. Play that beat over and over until a melody starts to suggest itself to you. Rhythm is usually the easiest place to start, but it doesn’t have to be done that way. You really do have complete freedom. Too much freedom.
So pick a rule, any rule and then work with it. Stick to that rule until you come up with something. Do not let yourself break out of it. You’ll be very surprised what you can come up with if you do this.
Of course, you could also take one of my creativity workshops, but that would be expensive, and besides, I’m not giving up my anonymity. That’s my structure, here.