Its based on page ranks and cross-linking. ITs a complex thing but the basics are ...Ignoring the "paid to get to the top" results, the best way of getting there is to use a simple layout that has lots of relevent text in the pages. Get your pages linked to from sites that are already well ranked (popular forums, as a signature etc), submit your sites sitemap to google, register as a webmaster and use their tools. Email me if you want some more info, im no expert but I've done it for some small pages. You can then sumbit to other search engines that allow direct URL adding. Also adding google adsense adverts seems to push your rank up a bit.

I spent quite a bit of time looking in to this as my site suddenly dropped out of the listings.

You need to add a robots.txt file to tell google what to look at and what to ignore.
You should also add a sitemap.xml file which will help describe the website for it to 'crawl'.
Log your website with http://www.google.com/webmasters/ and this will tell you when it has been crawled and how often.
Regularly update your website with new info/articles.
Get other sites to link to yours (be careful with this one) this can get you considered spam if you muck it up.

Avoid sites which pay for adding your site to search listings. Also worth manually submitting to yahoo and google.

If you don't understand the terms above then do a search on google. I had no idea what they were all about but did plenty of research.