The saloon was many things to many people.
The saloon was the hub of a Western town, serving as a bar, restaurant, gambling house, town hall, hotel, brothel, and sometimes courtroom and church. Often it was also the local stagecoach stop. There were few if any other places where men could gather (and it was a place for men). Town leaders, including the marshal, doctor and mayor could often be found there. It offered entertainment, food, drink, companionship, and was the closest thing to civilization that a frontier town had to offer. That’s why so many towns had so many saloons.