What you're asking is how to ride a bike without riding a bike.
You just ask, basically. But here are some tips. If we're getting along well, I'm usually already thinking of a social thing to invite her out to in a group, and before we part ways I tell her I'll invite her to this thing and for her to give me her number.
And I'm always careful to not use any "asking" words. Eg. instead of "Hey would you like to go to a dress up party? *wait for response* Cool, can I have your number?" instead (and with practice, it's almost second nature now, I can't think any other way) I say "Hey I'll invite you to this dress up party, give me your number." But again it's all about the delivery, not what you say, and that's inner game, and that comes with practice.
And if I don't have a social event coming up, I lie and make one up

Actually I haven't had to do that in a while, because I have a place that's cool to go to and I always say "Hey I'm going to X on monday night, you should come - it's awesome" tell her about it, and then get her number. That sort of thing.
Ideally, you use something in the conversation that you talked about. Just before you part ways - give her time to think you'll dissapear without asking, then go - "Hey we should do that thing some time, give me your number"