Generally speaking, the language doesn't have a concept of multiple servers. It works in isolation on its server. The fact there are multiple instances is not generally considered at the language level.
It is a bit like checkout staff in a super market, they each do their job. They don't need to consider if there are other staff or interact with them.
The question of how to route traffic/customers to different machines is in the architecture.
Edit to Address your revised Question:
You are now asking a much bigger question. There is no 1 fit answer, however let me give you a common setup example with php.
Lets say we have a php website which needs to allow a login function and a view rss feeds function.
We could have all the servers as general php - and they all perform login and rss viewing.
Alternativly, we could assign 5 servers for login and 5 for viewing.
There are a billion questions/issues that help us decide how to divide the architecture.
In the example above, it would be common for the login to be done via HTTPS - but the RSS viewing not to be done via HTTPS.
HTTPS servers have a higher resource usage than non, so it may well make sense to split HTTPS functions (login) away from HTTP (view rss)
Additionally, splitting static content e.g. CSS files, images away from PHP is often worthwhile. You can configure servers to be very good at serving static files while leaving your php servers primed for php.
We now have a scenario with a group of servers that handle HTTPS logins, HTTP viewing and a third group that hosts our css, images, javascript, etc.
There is a lot more on this topic, but there is plenty of material to read - google for scaling up applications or look for talks from facebook etc, who give out info on how they do this (to some level).