Dozens of posts in this slashdot thread about "It's easy. Just multiply your estimate X, by 2, or 3 or 4." Fine, but how exactly do you come up with X other than pulling it out of your ass?
Experience, my friend, experience. Unfortunately most programmers rack up lots of coding time but they never seem to get much better at estimating how long something will take. My educated guess is that programmers tend to be overly optimistic about their abilities and too eager to please. Believe it or not, my estimates (and I've made hundreds, if not thousands, over the years) tend to be quite accurate. But I realize I'm in the minority.