How to get website in google search result

Google is a search engine that go through each website and collects information about it and stores it in database.
Then google search algorithm decides which page is most relevant for searched text and displays it first and so on.