Believe it or not, some people have no idea how to do this.
There is a simple and logical flow.
1. Approach the bar
2. Make eye contact with a bartender
3. Order your drink
4. Recieve your drink
5. Produce payment
6. Tip
Now to break down each step.
1. Approach the bar
Easy enough. You walk to the bar. If there's enough space to be at the bar, do so. If the bar is full of people that are not moving, e.g at bar stools, and there's an obvious line, wait in it. If it's a wall of chaotically milling people around the bar, do your best to approach it without spilling any drinks. Keep in mind the bartenders will likely be at the location where it's easiest to make drinks. If possible, go to the bartender to get your drink faster.
2. Make eye contact with the bartender
Do not snap, whistle, yell, or just order. Bartenders do pay attention to when you arrived, and will try to take care of you in that order in most cases. They will point, ask what you'd like, or call you by name when they are able to get your order.
Things that will bump you down in priority:
You failed to tip previously
You order horribly complicated drinks
You are rude
Bartenders recognize you by two things first, what you drink, and how you tip.
If you have had a regular bartender that you're regularly ordering from, are approached by another bartender, and want your regular bartender? Take care of your regular bartender.
3. Order your drink
Don't know what you want? Don't go to the bar.
Have multiple drinks, shots, beers? Order them all at once. Don't make the bartender make a horribly complicated shot, then order the same one again. And one more for your friend.
Want the bartender to be creative? Give them something to work with. For example "I want something fruity with rum". Easy enough. I'm a fan of "I want something pink/ green/ blue", but not everyone is.
If it's busy enough, and you don't know, expect to have the bartender walk away.
If you're chummy with your bartender, feel free to make small talk, but realize they are working, and can be interrupted at any time.
4. Recieve your drink
Let the bartender set the drink on the bar if possible. The hand-off of a drink can get very messy and cause spills. At this time if something is off, mention it. If you're missing a drink, garnish, straw, etc.
5. Produce payment
Hand the bartender cash, a credit card, the name on your tab, your room number, etc. You do this after you recieve your drinks, so that all drinks are counted. If you use a credit card, indicate whether you'd like to keep your tab open or close it. If you intend to drink all night, don't close it after each round. That's a massive pain in the ass. And remember to pick up your card and close your tab at the end of the night.
Regarding cash, too big or too small is bad. Handing a $100 bill for a beer is as bad as a handful of dimes and nickels for a beer. If you do either, apologize
6. Tip
This bit makes a big difference in your experience at a bar. Trust me. A smile and a thank you is nice, but not what we're working for. Bartenders often make $3-5 an hour.
The reasons behind tipping well:
You'll be remembered, not just during the night, but the next time you come in.
You be taken care of quicker.
Your drinks will get stronger.
Your bartender will actually like you better.
What happens when you don't tip:
Your drinks become weaker
You will be ignored
The bartender will tell the other bartenders to make your drinks weaker
You will be generally regarded poorly
A last thing; If you don't have the money to tip, you don't have the money to drink.
There is really only one exception to this rule. You are a regular, know the bartender well, and promise to 'get them the next time', and do.
Well, two exceptions. You could also be sleeping with the bartender.