In more detail
It checks which back-end servers are healthy and sends each request to one of them, using a rule such as round robin or least connections. This adds capacity, lets servers be updated without downtime and removes a single point of failure. Layer 4 balancers forward TCP or UDP connections by address and port; layer 7 balancers understand HTTP and can route by host name or path, such as /api to one pool and everything else to another. "Sticky sessions" send a user back to the same server when session data lives in that server's memory. Many load balancers also terminate TLS.
Why it matters
Badly tuned health checks either keep sending traffic to a dead server or remove healthy ones. Back-end servers see the balancer's address as the client unless they read the original one from a header such as X-Forwarded-For; otherwise logs and rate limits lump every visitor together.
Example
A minimal nginx configuration that spreads requests over three servers:
upstream app {
server 192.0.2.11:8080;
server 192.0.2.12:8080;
server 192.0.2.13:8080;
}
server {
listen 80;
location / { proxy_pass http://app; }
}
With nginx's default round robin, requests 1, 2, 3 and 4 go to .11, .12, .13 and .11 again.