Search engine optimization has always been a blessing and thorn in the side of so many webmasters. There is so much to learn if you truly want to master the art of SEO, but I will cover the basics here. SEO can be broken into two parts: on-page optimization and off-page optimization. Let's start with on-page SEO.
When a user searches in Google, their search is formally called a "query." Google wants to return the most relevant results for that query. For instance, if you search for "dog toys," it's Google's job to return pages that are full of dog toys. Now, the way Google does this is incredibly complex and frankly understanding it is above my pay-grade, but here are the essential ingredients: relevance and intent.
First, a result must be relevant. Pages about cooking obviously shouldn't show up. More specifically, pages about kids toys or dog training shouldn't show up either. Now, here's what happens in a real life search. Google finds thousands of pages that are all about dog toys. They need to find the ones that are the most relevant. The trouble is, they're all so relevant that they can't simply be ranked on that alone. In fact, Google mostly uses relevance to collect a seed group of pages and then uses a sorting algorithm with difference factors to give you the top 10 results you're so used to seeing. Here's the takeaway: if there's a keyword you want to rank for, your page needs to be highly relevant to stand a chance at ranking. You make your page relevant by, well, making it about the term! If you want to rank for dog toys then publish a page on your site about dog toys. Pretty simple stuff. There are a few technical steps involved with on-page optimization that include putting your keyword into the title, heading tags, etc. This stuff can be learned in minutes and you'll find a good overview from Moz here.
These days, you have to move beyond mere relevance and think deeply about the intent of the user. What does someone searching for "dog toys" really want from a result? If you think they want an article about dog toys, you're sorely mistaken. Think about that: an article that is about dog toys and is perfectly optimized for the phrase "dog toys" doesn't stand a chance at ranking in the top 10 for the query "dog toys." That's because people who search that want to purchase toys for their dogs. The only way you're going to rank is with an eCommerce product page (more likely a category page) or with a blog post where you list out the top toys for dogs. If you spend a little while thinking deeply about this, you can make some good guesses as to what people want from any given query. However, it's much more practical and effective to get out there and see what's ranking. Whatever pages are ranking now are the types of pages Google wants to see. If a page is ranking higher than you think it should, it may be because it better serves the intent and you should follow in their footsteps.
There are other sitewide, technical aspects of on-page SEO, but we'll need to leave that for another day. For now, the two lessons are to optimize for plain old relevance and simultaneously optimize for the intent of the searcher. Make sure to think about what someone will want from their search before you write a word of content. You may end up creating a video or product instead!
Ah everyone's favorite SEO topic, link building. Yup, link building is 90% of what people are talking about when they say "off-page SEO." These days, reputation management and social signals are a part of the mix, but again, that's advanced and where not going there right now. Let's stick with an overview of link building.
What is link building?
So now you know that Google finds relevant pages that will serve the searcher's intent, but there's another big piece of the ranking puzzle. Google would rather rank pages higher that people have already said they like. One way the web "votes" for pages is by linking. Think about this: you've got a website with a bunch of tasty and healthy recipes. People with blogs and social media accounts will share and link to your recipes. Maybe the FDA even links to your site on one of their pages as an example of modern, healthy eating. If your site has a lot of these links (think votes) from other sites, they know it must be good. Now imagine you are up against other sites with very similar recipes. How does Google split the tie? By the site that has more links. That's more or less how it works, but I think I may be downplaying the effects of links. Hopefully this will change more in the future, but for now, we often see pages outranking better pages purely because they have more links. There's basically no way around it, if you want to rank well, you need to build links.
I hope you have a better idea now of how Google works and what it takes to rank in the search engines. At the end of the day, it's all about creating relevant and genuinely useful content for your audience. Getting search traffic is a longterm gain - it can really take forever when you are launching a new site. If you build an email list and generate traffic via social media, you should get plenty of engagement while you're getting your ranks in Google.