The program comes with a list of large stable nodes
My understanding is the list is long and it includes very stable old nodes that hardly ever go down.
Actually that is the last resort.
This is specific for Bitcoin Core, it may be different for other nodes.
First the node checks for its own list of peers that it has built. If it is a new node, that list won't exist.
Then it will check with several DNS seeds, servers which provide a list of nodes. Those DNS seeds are hard coded into the client.
If for some reason the DNS seeds aren't reachable, then it resorts to its own internal hard coded list of seed nodes. Those seed nodes are nodes which have had a super high uptime so it is likely that the node will be able to connect to those.