A search engine uses an algorithm to determine which sites are probably going to be most useful to searchers, and should therefore be at the top of the search results. Because this is an automatic process done by a computer, it is often wrong. SEO tries to discover the factors that allow a site, or page on a site, to rank highly for a series of related search terms.
For example a site in Alaska that advertises for pedigree dogs would want to show up when people search for any combination of:
"alaska, pedigree, dogs, breeding, show, etc"
so these would be the search terms this site is targetting.
There are many things to consider when implementing SEO, which can be basically separated into "On Page" and "Off Page" factors.
Off Page factors are mainly links to the site. Having a large quantity of links is not as important as having good quality links. One hundred links from sites unrelated to your topic won't help as much as a handful of links from sites on the same or similar topics that are already ranked well.
On Page factors include the age of the site, content, meta tags, alt tags, keyword density, navigation, outbound links to other sites, and how the site is coded.
No one thing will make your site successful, it is a sensible combination of all of the above, and remember that your site should be designed to be good for users before worrying about search engines.
A search engine discovers your site by one of its bots/spiders following a link it finds elsewhere on the web. It will take a look and put your site on a list to come back later and take a proper look around.
When it is reading your site, it can't see images, it can only read code and text. This is why alt tags and titles are important for images, so the search engine knows what it is looking at.
It needs to be able to find all the links to various pages on your site easily and to find which is the most important content. Use of paragraph, heading, list and emphasis tags will help it see what's going on.
SEO is very complex, and there are just as many ways to trigger a penalty for your site that will make it drop in ranking as there are ways to make it rank well.