My first customer was someone I knew from the Internet, who had a clearly achievable path to a programmer making him money. Without spilling his beans: he ran a decently sized business doing something on the Internet and was not a developer. There were some fairly obvious things about that arrangement which I could fix. I fixed them.
Thomas' company was, IIRC, my 2nd or 3rd client. He knew me from HN and the ability to talk about a topic of interest to his business over a cup of coffee. Take a look at his writeup of our conversation. You can reasonably assume that our consulting gig involved humming similar bars.
As to who in general buys programming services: go to meetups or events. Talk to people. If they buy, problem solved. If they sell, ask who (in general terms, if you're uncomfortable) buys from them. To a first approximation, everyone who has ever hired a programmer will again, at some point in the future, again hire a programmer. Same goes for consultants, etc.
If you just want to learn about realities of industry work passively, doing it for a few years is also an option. After you've built CRUD apps in a non-tech employer for 6 months you should have a 98% accurate mental model of which businesses routinely buy software in a fashion other than available-totally-off-the-shelf.
Another heuristic you can use is that one white collar employee represents $200k a year in revenue and that anyone with $10 million in revenue probably could benefit from custom software development.