When an HTTP client (generally a web browser) requests a URL that points to a directory structure instead of an actual web page within the directory, the web server will generally serve a general page, which is often referred to as a main or "index" page.
index.html is the traditional filename for such a page, but most modern HTTP servers offer a configurable list of filenames that the server can use as an index. If a server is configured to support server-side scripting, the list will usually include entries allowing dynamic content to be used as the index page (e.g. index.php, index.shtml, default.asp). An example is the popular open source web server Apache, where the list of filenames is controlled by the DirectoryIndex directive in the main server configuration file or in the configuration file for that directory.
If the server is unable to find a file with any of the names listed in its configuration, it may either return an error (generally 404 Not Found) or generate its own index page listing the files in the directory. Usually this option is also configurable.
In theory, for relative links to function properly, the URL pointing to a directory should end with a forward slash. Otherwise most web servers will send an HTTP redirect to add the slash.
For example, strictly speaking
http://www.example.com is not a valid URL and most browsers and servers will redirect to
http://www.example.com/ where the index page from the root directory will be displayed.