USB Comm to Arduino and ESP8266-13 wifi Shield

Hi,
I'm new to Arduino and I'm learning how it works, especially the Arduino + ESP8266 version 13 shield I bought as part of a robot car kit from Osooyo.

I have a very basic question;-

How do the 2 microcontrollers (Arduino + ESP2866 version 13) get programmed together via 1 USB connection to the Arduino IDE ?. Each has flash memory, what decides which memory the USB data goes into ?

I'm trying to understand the basic method;-
Do the 2 devices read the same sequence of USB data ?
or
Does all the USB data go to the Arduino , and that microcontroller later program the ESP8266 ?

I'm trying to understand the basic method. I guess my question applies to any Arduino+intelligent shield.

Many Thanks

How do the 2 microcontrollers (Arduino + ESP2866 version 13) get programmed together via 1 USB connection to the Arduino IDE ?.

You need to show how the two are connected. If the ESP2866 is in a shield attached to the Arduino, you do not get the opportunity to program it.

PaulS:
You need to show how the two are connected. If the ESP2866 is in a shield attached to the Arduino, you do not get the opportunity to program it.

why not?

if atmega is hold in reset and esp is connected to rx/tx and in flash mode, it should work. I plan to try it this weekend as part of writing the "How to install WiFiLink firmware on generic ESP8266" tutorial.