A web host rents out server space and connection to you so that you can make your website available on the Internet. Web hosts are responsible for keeping the server (and your website) online and for maintaining and upgrading it.
Larger web hosts have hundreds of servers. A network of servers in a specific location is called a datacenter. Datacenters have fast connections to the Internet, 24/7 monitoring for secure access, UPS and battery backups in case of power failures, controlled temperature and humidity, and so on, providing an optimal environment for the hardware systems located in the facility.
Depending on your budget and your needs, you can rent from the web host a whole server, you can share the rent on a server with others, or you can even buy the server and pay only for the connection and the maintenance. So, when we talk about web hosting, we talk about three types of hosting: dedicated hosting, shared hosting, and collocated hosting.