Typing in routes by hand works for a few routers, but not for hundreds, and it can't react when a link breaks. Routing protocols let routers tell each other which networks they can reach, and work out the best paths on their own.
Inside one organisation, a common choice is OSPF (Open Shortest Path First). It's a link-state protocol: every router tells all the others about its own links and their costs, so each one builds the same map of the whole network and works out the shortest path to everywhere (with Dijkstra's algorithm). When a link fails, the news spreads and every router recalculates in a second or so. The older RIP simply counted hops and is rarely used now.
The internet is made of autonomous systems (ASes): networks run by one organisation, like an internet provider, a university or a big cloud company, each with an AS number. There are about 75,000 of them. Between ASes, routes are shared with BGP (Border Gateway Protocol).
BGP is about policy more than distance. Each AS announces the address prefixes it owns, and passes on routes it has heard, adding its own number to the path. Each AS then chooses routes by business rules (customers first, then free peers, then paid providers) as well as path length. Your packets to another continent follow whatever the ASes on the way have agreed.
BGP trusts what it's told, which is its weak spot. If an AS wrongly announces someone else's prefix, by mistake or on purpose, traffic can be pulled the wrong way: a route leak or hijack. Big outages have started this way. RPKI is the fix: owners sign which AS may announce their prefixes, and routers can reject announcements that don't match.
Practice
What's the main advantage of a routing protocol over static routes?
More info
Quick reference
Routing protocol
Routers share and update routes themselves.
OSPF
Link-state, inside one organisation; shortest paths.
RIP
Old; counts hops.
AS
Autonomous system: one organisation's network, with a number.