It seems to me that, not unlike today, pistols (handguns) are/were largely meant for killing other people. A rifle seems to be far more all-purpose, and I'd guess that would be the gun of choice for most people. The one exception I can think of is law enforcement. There's former military, but civil war-era soldiers didn't carry pistols unless they were officers, right? Finally, there's simply the expense, both for the weapon as well as possibly different ammo.
It seems the image of cowboys running around with six-shooters and having showdowns is more a thing of the movies than actual history.
Pistols were common enough in certain areas that towns (like Dodge City) passed city ordinances forbidding people from carrying weapons within city limits. Depending on where, when, and who you're talking about, you'll get a lot of variance, however. For example, a person working in the mines, or a farmer, banker, or farrier wouldn't have had much use for one at any time or in any place out "West" so it would have been rare to see them carry a pistol. On the other hand, a person in law enforcement, a professional gambler, or a cattleman (often called a "puncher") would usually be packing, as their profession deemed it a necessary tool of the trade. A cattleman or puncher, for example, carried a pistol because when on a drive, it was a useful tool for killing snakes, putting down sick or injured livestock, and protecting your investment.
Now, depending on when and where you're looking, things varied. To take another example, someone in Denver in 1890 might have never needed a pistol, and therefore would not have carried one, while a person in 1875 Abilene, whether he was a bartender or a bandit, would have likely carried a pistol regardless of their profession.
It really did depend on who you were, where you lived, and what you did for a living. Shootouts did happen, and face-offs like you see in the movies, while far more rare, did also take place every once in a while. Pistols had many uses in the West, however, and while they are an iconic symbol of violence between people, more often than not, they were used to intimidate rather than kill, and even more, as a tool for keeping animals under control (snakes, livestock, etc). Ammo was expensive, and if you wanted to use your pistol with any kind of proficiency, practice was absolutely necessary. Not many people could afford such an investment, so while violence as a result of pistols did occur, it was usually a messy, quick affair that involved a lot of ambush-style attacks.
[Source: Michael Denning, 'Mechanic Accents']