Start by reading the Moz blog, and analyize well established websites with SEMRush, Ahrefs, SimilarWeb, etc.
Then you have to go trial by error. Create a new website, tweak everything in the code and file sizes so it is fast and search engine optimized, and then finally start getting backlinks.