The key here is to first build flirting excitement with the guy. If you just walk to him and ask him out, it's like going from ground zero to a 5'000 m mountain top. All at once, it can be thrilling! that's great and soon you might be so confident at it that you'll just do it naturally.
If it's just too much to take that big step, simply build up and take smaller steps. Build the flirting game: smile, be fun to be with, exchange meaningful eye contact with him. This will give you a taste of what he is up to.
If you feel that your life is being played there, on the spot, it's just too much at stake! It's not the case. A Yes! would be great but you must have a strategy for any situation. No fear! You go there to win! Now, winning is emotionally winning. No one can disturb your confidence!
A guy will go for it if he already got a taste of what you have to offer. If he sees you as a fun-free person, he'll respond to your presence for sure.
The confidence boost comes from being used to these type of situations. You get used to the flirting game by being part of it, trying, experimenting with it. Once you are familiar with it, asking a guy out comes very naturally. It is already part of you. It's simply your natural next move.
Asking out is like scoring at this game! To get a chance to score, you need to be in the game, engaged, familiar with the moves. You can't score if you watch the game from the side of the pool. Jump in the water and play!
There are many moments you can score. There are many right moves. What you want is hit the target! To hit the target, follow your instincts. They are your greatest force and your deepest ally. Be flexible, ready to move. You must be alert! awake!