The key to getting a girl's number is to never ask for it; instead, casually tell her you need her number so you can meet up again some time. Additionally, you want this to occur at the height of the conversation, according to Art of Charm.
Do not wait until the conversation winds down and you are about to walk away. Art of Charm suggests having your phone ready and physically handing her the phone, giving her the ability to insert the number herself. Askmen suggests getting girls' numbers as often as you can, even if you don't plan on calling them back.