It's a variety of factors.
1) Technology eliminated the need for many gigs. From when jazz and rock became a thing up through the 60's and into the 70's, bands could gig at strip clubs, dinner clubs, school dances, and really anywhere where someone wanted background music.
But the as modern stereos, speakers and DJ equipment improved, most of these gigs were eliminated. And face, no one went to a strip club or a dinner club for the band, they went for the experience, which could just as easily be made with piped in music. School dances found it easier and perhaps more entertaining, to have a DJ play top hits rather than a local band slog through cover tunes.
Even in my 20's in the 90's, I gigged at a ton of bars where it was pretty obvious the band was just in the background. The people sitting at the bar at the end of the night were the same people who were there drinking when we set up. They came for the alcohol and social factor, not because there was a band there. Sub in jukebox system, the bar saves money, and people still come to drink.
2) Karaoke. People who do go out to clubs often choose karaoke bars where they can sing along to pre-recorded tracks. No need for a band. There are a ton of people who visit karaoke bars 1 to 3 times a week without fail. This takes away from the people who feel the need to seek out live music.
3) The biggest factor, IMHO, is there is less of a reason for people to go out. It used to be if you wanted entertainment on a Friday/Saturday night, there wasn't much to do at home. You had a radio, a TV that is small by today's standards that got 3-4 channels, or maybe 20-30 with cable. VHS improved the home experience, but it was still SD format. People were just more motivated to go out.
Now, so many people have a large screen HD TV with surround sound audio, and it's connected to cabe/satellite/internet service that gives them 300-600 channels, plus movies on demand.
And where as video games used to be the realm of kids and teens, now there are more and more high definition realistic video games that appeal to adults. In addition, you can play them with other people via the internet, allowing people to "socialize" online without leaving the house.
All of this isn't just affecting music, but movie theaters have taken a big hit as well, because people just do not need to leave the house to be entertained.
Even if you love music, you can put on your favorite band's blue ray, on a large format TV with a killer audio system, and have a music experience at home.
3) Online dating. For many years, the primary reason to go to a club/bar was to meet a mate. Personal ads and online dating was considered somewhat taboo. Now, you can't turn on the TV without seeing an ad for an online dating site. It's now considered not only acceptable, it's moving toward becoming the primary way people meet. Which has eliminated a major motivation for people to go out to clubs/bars.
4) DUI laws. Many DUI laws didn't exist 20-30-40 years ago. And most DUI laws weren't as restrictive as they are today. My grandfather's friends used to have some funny and not so funny stories about going out, getting hammered, and driving home, because it just wasn't considered illegal, or a big deal back then. Even in recent years when they lowered the standard from .10 to .08, that impacted how people felt about going out.
5) And I agree the proliferation of pay-to-play or other systems where bands are not booked on quality. And because quality is not a factor, people get turned off from going to that venue, and opt for other things.
6) Youtube. There are so many hours of killer footage of all sorts of great bands online. You can find concert footage from the 60's, 70's, 80's, etc online.