When is it better to quit then to pivot? Seems like with pivoting you are able to make better use of your experience then if you quit and start something completely new.
I can't say in general, but I can share my own experience. I did a YC startup, struggled, quit, and made the Rails Tutorial (which has gone extremely well). There wasn't any way to pivot from the startup to the tutorial; they are completely different kinds of businesses. Among other things, my startup had a cofounder and investors (i.e., YC), whereas the Rails Tutorial is a solo enterprise. Developing an intuition for when to shut things down and move onto something new is an invaluable skill, one I'm only beginning to master.
Inbound links, organic search, and word-of-mouth are the main methods. I experimented with AdWords, but the conversion rate wasn't good enough, and I was too lazy to try to improve it.