The variables that factor into that ranking are too many to count. They include a website’s title, its URL structure (see permalinks), the structure of the web page HTML, the quality and quantity of the content on a site and which other websites link to the web pages on the site.
WordPress takes care of some of the basics out of the box. It outputs a title for every page, lets you choose a readable permalink structure, and generates an XML sitemap that helps search engines find all of your content. If you don’t want your site to show up in search results at all, you can check “Discourage search engines from indexing this site” in “Settings” → “Reading”.
There are numerous WordPress plugins that assist website owners with optimizing their content and settings for good SEO. Some of the more popular ones include Yoast SEO, All in One SEO and the SEO tools in Jetpack. If you’re willing to pay for it, there are also plenty of agencies that can help you with analyzing and optimizing your website for better SEO performance.