On WANs or wide area network is the connection that spans over geographic regions. In order to obtain such a connection the LAN must go through a telecom provider who creates these links thanks to the telecom leased Lines(PPP, HDLC, SDLC technology). Now very long ago Leased lines were very expensive. Enter WAN technology, which provides such connections but at much cheaper prices.
Different WAN Types
Frame Relay which is such a technology . Which provided a much cheaper connection mainly because one could do point to multipoint thus organizations could expand without fearing costs, however frame relay was replaced (just like it replaced x.25) by ATM technology.
After some time because ATM provided more overhead than framerelay many network engineers agreed that ATM should be replaced with a protocol that requires less overhead, while providing connection-oriented services for variable-length frames. MPLS is currently replacing some of these technologies in the marketplace. It is highly possible that MPLS will completely replace these technologies in the future thus new types of services such as VPLS, L2VPN, L3VPN can be adopted for an organizations needs.
BGP is a routing protocol like any routing protocol shares its routing tables but between different AS ( autonomous systems). Thus with Routers knowing the routing tables of others are able to know the source IP and Destination IP.
So first you need to provide a connection ( MPLS/ATM/FRAMERELAY)
Then you choose your Routing Protocol that will work among the routers (BGP/Exterior EIGRP between AS OSPF/EIGRP for interior networks).
You can read all of this in any ccna book where it gives you a more detailed history on these technologies.