Let's say that the public address of a NAT router is 22.214.171.124, and on the inside there are three hosts with private addresses 10.1.1.1, 10.1.1.2, and 10.1.1.3 resp. acting as servers. If a HTML-request comes from the Internet with the socket 126.96.36.199:80, how does the router know to which inside-local address to forward the request to?
There are three ways this is typically done when the outside has a single IP address:
Different ports: the outside router would accept TCP packets on say, ports 80, 81, and 82. It directs the packets internally, eg 188.8.131.52:80 -> 10.1.1.1:80, 184.108.40.206:81 -> 10.1.1.2:80 .... Cisco calls this Port Address Translation, and there are endless resources on the web about it.
Load balancing: one outside-facing machine 10.1.1.1 gets all the traffic, and has some method of determining the load of the inside machines, and forwards the requests to the least busy of the workers 10.1.1.2 and 10.1.1.3, which each offer the same content. The router just does routing and NAT. Server software is off-topic here, but you could start searching with HAProxy, one of the better known load balancers.
Reverse proxy: one outside-facing machine 10.1.1.1 gets all the traffic and is a web server which has branches of its space forwarding to inside machines for different services; again the router just does routing and NAT. For example, you might send
/forum-> 10.1.1.3. This method is also used when serving URLs on different domains. Most web server software will do reverse proxy functions, including Apache, though again server software is out of our remit here.
[EDIT] Occasionally you see source address selection, which is sometimes used as an approximation to geolocation for content selection. In this scheme the router sends some traffic to each server depending on the source address. Search Cisco docs for "policy based routing". (Don't do geolocation on a router, do it on the web server where it's much easier and much better.) I've also seen it used for simple load balancing too, one of the few places I've seen "wacky netmasks" do anything useful: eg forward to four servers based on the bottom two bits of the source address. The reason these techniques are rare is because they are generally are a really bad, unmaintainable, idea.
[EDIT 2] Transparent web proxy As pointed out by others, some "routers" also will do non-router functions such as inspect the incoming request and route it according to the URL in the request. Making routing decisions based on upper-level content is considered fine by some and horrendous by others. In general my advice would be to keep routers absolutely as simple as possible, and do upper-level functions with machines dedicated to that task. Most especially if the devices are externally facing.
You must specify router model you have. For Mikrotik exist - https://wiki.mikrotik.com/wiki/Multiple_Web_Servers Maybe you can get something else.