What happens in the real world Internet - BGP and OSPF?

Typically, autonomous systems (ASNs) use an IGP (which can be OSPF, IS-IS or iBGP) so routers in their network know how to reach eachother. Networks connected to these routers and reachable through them can be distributed via this IGP as well, but iBGP may be used for that too.

ASNs exchange routing information via BGP. Typically, only aggregated prefixes of their networks are exchanged. So if an ISP has 100.0.0.0/16 as their IP space (assigned to them by a RIR) and breaks that down internally to various /24's for its customers and services, only the aggregated /16 will be announced to peer ASNs. These other networks know how to reach that network then, and the network can then use the routing information in its IGP to reach the exact destination.

Even with these aggregated routes the number of routes in the global routing table is still quite large: currently about 615K IPv4 routes and 32K IPv6 routes, and it's still increasing.