Depends, is it for stuff you've done before or stuff you have no idea how long it will take? When we do project estimates at work, first we try to talk to the customer to get the basic idea of what they want and then we break it down into components and how long we think each one will take. Then we add a certain amount of overage based on how sure we are we have the requirements right. Could be anywhere from 10%-100%. We'll also take a crack at guessing how long it would take as a whole with dedicated time. And finally we'll try and compare it in terms of other projects we've done. If we're close on all three methods, that's good if not, we lean towards one way or another or we review our estimates to try and figure out why they're off.
If it's something you've never done before (as many are) just estimate what you know and then build in a conditional for change orders. And expect that there will be some. Always make the client sign off on your proposal and make sure they know that if it's not correct (requirements wise) that change orders are likely to be needed.
You can read books about it all day long but I think it's really an art.
My answer (from a much wiser man than me)
It will take as long as it takes.
Often times it's the balancing act between speed/quality/price; pick two.