Google can be your friend, your enemy, or neutral. It doesn't have emotions, it has algorithmns.It doesn't have opinions in the same sense that you do. Its likely the biggest machine in the world, and its primary purpose is to try and replicate your opinions.It wants to feed you the content that it decides you are looking for.
So how does Google work? Well that's a pretty complicated one to answer in a snippet. Essentially search engines were built using the fundamental concept that "if people think you're important, then you are". Google is imitating the mass of human consciousness.
Folks like Altavista, Lycos, Dogpile,Yahoo (remember these names)? all took the same position as Google, except Google did it better.The fundamental underlying principle was and still is, if websites link to you, that increases your website's importance from a website searcher's perspective.
To try to put it in some context, and this is a somewhat difficult concept to wrap one's head around, those links would drop what is termed 'link juice' – best understood as a drip of respect. So the websites linked to your website, therefore you must have been worth linking to, which made you relevant to what the searcher was seeking. And a site designed by quality web design companies helps a lot.
As search engine optimization evolved as an industry (very rapidly and very lucratively), the main goal was obtaining inbound links. These links were not necessarily useful to a user. They operated for example as blog comments. So a blog article's comment section would fill up with irrelevant comments such as "nice job sir", with a link back to the commenter's website. What we call spam, which is of course an endemic modern day problem.
The web itself evolved of course, and continues to, so has Google. Currently there are estimated to be over 400 ranking factors that go into where you sit.However there are a handful of said factors that primarily influence your website ranking .
-Is the website fully mobile responsive?- a lot of organizations still retain websites from many years ago that are somewhat illegible on a phone. Since over 50% of google searches are conducted on a phone, these websites get heavily demoted. Responsive web design means generation of websites in such a manner that the device, be it a laptop,desktop,pad, or phone 'understands' the format and renders it appropriately. The solution to problems with ranking if not mobile compatible, is of course to construct a new fully compatible website.
-What is the website about? Remember Google does not have opinions, the only way the machine can understand what your website is about, is if you tell it. So content is king, this is an old adage- but still very much the case. If you wanted to rank for 'grey hypothetical 8 legged crabs from maine'-you could create a website with a url called grayhypothetical8leggedcrabsfrommaine.com and on your home page write a bunch of informative content. Guaranteed you will quickly rank in # 1 position for this search.
-Who links to you?-Remember if people think you're important, then you are. Google robots crawl across links on the web (there are many billions, if not trillions). They assign weight based on how important they view the website linking in. So if IBM or the United States Government website just linked in to you, you just got a huge SEO boost. If the pizza shop down the road's website just did, not so much. Inbound links are still judged by most SEO experts, and the author, to be the single most important search engine ranking factor.
-Website load speed. Nobody has the patience these days for a website that takes ages to load. They will flee the scene and move on to another site. Google knows this and acts accordingly.
To summarize- there are 2 sets of factors, onsite factors which relate to how the site is constructed, and offsite factors, which means in a nutshell "who links to me".Search Engine Optimization companies tend to charge a lot of money, and convey the impression they have big secrets to justify such charges. Its no big secret, it boils down to technique.
Build the website right, and then invest in an inbound link building strategy. Yes link building is time intensive, but its worth the investment.Good luck with your SEO efforts.