The Layer 7 balancer terminates the client connection. The client opens a TCP connection (and a TLS handshake for HTTPS) with the load balancer itself, not with the backend. The balancer decrypts the traffic, reads the full HTTP request, and only then decides where to send it.
It then opens its own connection to the chosen backend, usually reusing a pooled keep-alive connection so it does not pay the TCP and TLS setup cost on every request. The request is forwarded, the response comes back, and the balancer relays it to the client. Two separate connections exist: client to balancer, and balancer to backend.
Routing rules are evaluated in order. A typical config matches on host and path first, picks a backend pool, then applies a balancing algorithm within that pool such as round robin, least connections, or a hash of a cookie for stickiness. Health checks run continuously so a backend that fails an HTTP probe is pulled out of rotation.
The cost of all this is CPU and a small amount of latency. Parsing HTTP, decrypting TLS, and maintaining two connection sets per request is heavier than the near line-rate packet forwarding a Layer 4 balancer does. In practice the overhead is a fraction of a millisecond per request, which is fine for almost every web workload but matters at very high packet rates.