Search engines such as Google and Bing list websites in order of importance. They consider lots of things when working this out, for example, whether important sites that are similar in nature link to you. On the basis that if that site wants to link to you then your site must be of some value.
Another aspect is how well your site matches the words the person searched for. This is not only whether those words are in your site but how they are used.
SEO or Search Engine Optimisation refers to all the ways that are used to increase the chances of a site being listed higher.
The main search engines have rules and when done correctly SEO can work well but if done incorrectly it can lead to a site being penalised or black listed, so always be careful.