Mostly learnt on the job. But then testing, testing and then more testing over the years... quite often i'll build sites differently to see how they perform in the SERPs.
Alot easier these days with all the blogs, resources and tools around. Although there is still fun to be had if you dabble in black hat techniques... you won't find many people talking openly about that - especially the ones that work!