Whenever BGP has multiple paths to a destination they will be stored in the BGP table. Both will be in the BGP table but there will be only one in the routing table, and BGP will select the best path based on BGP attributes.
And here's the heroes :
1. Weight
-> Cisco Prop.
-> Local only router, so its not exchange between BGP router
-> Highest Weight is preferred
-> Default value is '0'
-> Outbound Traffic
2. Local Preference
-> Used to exit point from internal AS -> For outbound traffic
-> Sent to internal BGP router, not exchange to eBGP router
-> Default value is 100
-> Highest Local pref value is prefered
3. Originate
-> BGP Router will prefer route's if its locally originated (next-hop 0.0.0.0)
4. AS-Path
-> For inbound traffic
-> Shortest AS-Path is prefered
5. Origin Codes
-> i (IGP) -> Means you advertised network yourself in BGP
-> e (EGP) -> Doesn’t use anymore
-> ? (Incomplete) -> Means you redistributed something in BGP
6. MED (Metric)
-> For inbound traffic
-> Exchanged between AS & propagated to neighbor AS only.
-> Lowest MED is preferred
7. Path
-> BGP will prefer external paths (external BGP) over internal paths (internal BGP)
8. Router ID
-> Last decision maker! -> Lowest address is choosen