You work really hard to get your first clients, fighting for each billable day, dealing with lots of dry spells. Then you "roll them up": you over-deliver and establish a reputation at those clients, find more work inside of them, and ask them for referrals. The stories you generate from over-delivering becomes the ammunition for any promotional work you to to generate new bluebird inbound clients.
There is no secret trick to getting those first clients. It's a scary suck for most people who build successful consultancies. The "trick" is in carefully and aggressively exploiting those hard-to-get first clients in order to make subsequent clients easier and easier to get.
1. At university there was a billboard for people looking for developers.
2. Responded to everyone, with a ridiculously low price of $25.
3. Completed first job with flying colors. Collect glowing reference.
4. Stitch up reference on to personal website.
5. Hike price by 50%, find next client.
6. Rinse and repeat.
I got up to $100 per hour for some clients[1], or $450 per day for other clients, before I finally found a full time developer job.
I'm glad I did this freelancing thing because my company knows I can walk any time and make 6-figures on my own.
I still get pinged by my former clients about new projects and refer them to friends.
[1] (I was offered $115 one time but I felt that was too much of a raise - I priced myself at the highest possible rate where I am certain I will receive a glowing reference. And glowing references means raises.)
P.S. I read patio11 and tptacek's advice at the time it was very useful.
As a consultant it's rare I had engagements lasting more than a couple of months. At a company there's more of a "narrative". It's like reading short stories vs reading a novel, both are good at various times.
tirrellp makes a good point, though. I guess that's how?