What is a localhost?
A localhost is, put plainly, the standard hostname given to the address assigned to the loopback network interface. Translated into an IP address, a localhost is always designated as 127.0.0.1. This may be overwhelming, so let's look at what these things mean.
Hostname is the term for the label that is assigned to any device connected to a computer network and is used to identify the device across the web. A hostname usually consists of a single word or phrase and can be followed by a Domain Name System domain at the end. That is, a website. Used this way, the hostname is called a domain name. An example of using a hostname this way would be: hostname.domain.
In short, hostname is the nickname that is given to a device connected to a computer network.
A loopback network interface sounds complicated, but is in actuality very simple. It is a virtual interface used for system management; such an interface exists but not in a real sense; it is simulated by the computer. This interface is assigned a special address that can be accessed by management over the network but lacks ties to any real device connected to the network. Applications can also use this virtual interface to send and receive packets (pieces of data) through, as opposed to using a real interface.
Back to a localhost; it is also a registered domain name. This means it is a registered name on the Internet, specifically the web, that is specially reserved for a singular purpose as a localhost, to prevent confusion.
So why use a localhost? Not only does it make connecting to local servers, such as in a Local Area Network, extremely efficient by routing traffic through the address, allowing a direct route to any service on the server, as opposed to specifying a specific route for each service. Services being programs, games, documents, databases and whatnot. But it also makes it easier to access via the web, thanks to being a dedicated, registered domain name.
Computer networking can be a confusing and baffling practice, based on how much you know. Armed with this knowledge, your work can be easier and your home computing can be more robust and easy to use.