Search engines like Google are database applications which index pages from websites. The indexing is done by bots or crawler programs which are part of the search engine application. So, when a site is indexed by Google, its pages are stored in the Google database. For various reasons, your site may be removed from the index (database). Some of these reasons are
1. You fail to renew your hosting when the hosting contract expires
2. Your site has very few incoming links, so the spiders can not find it
3. You violate the TOS of search engines
When your site is deindexed, naturally you would lose your rankings too. If your site is deindexed because of reasons 1 or 2, you can get it reindexed easily by making sure your site is online and by builidng inbound links. However, if you have violated any TOS, you'd have to make corrections and send a request for reinclusion (in case of Google, it is done from Webmaster Central). Hope it helps.