Quoting emirates202 (Reply 2), "how do ground crew in GRU
know which is going where? Do they get a sheet telling them?"
emirates202, are you serious? Do you think the ground crewmembers at Sao Paulo (in your example) just wander out on the ramp, flip a coin to decide what destination to send each aircraft, then stand around and wait to see what happens?
The scheduling and routing of aircraft is a fairly complex process. It normally begins with Network which decides the optimum capacity and capability of each type of aircraft to serve various routes and can change depending on day of week, season, special events in destination cities, etc. That information is then forwarded to crew scheduling and Maintenance Control.
Maintenance Control will assign a particular aircraft to a specific route several days in advance and it is predicated on forecast maintenance requirements of the aircraft (i.e., will the aircraft be in a maintenance station when a specific check is required). Occasionally it is also based on aircraft configuration (i.e., at Delta, some of the Airbus A-319/A-320 are configured for overwater operations, while others are not). At some airlines, Southwest (I think), Maintenance and Crew Scheduling coordinate as well to try to schedule the aircraft and crew on the same routing to minimize the number of times crews change aircraft during the course of a day.
With regard to your original question, "does the same one that came from JFK
go back?" No, not necessarily.
Once the particular aircraft is assigned to a route, this information is forwarded to the Dispatcher, who develops the entire flight package for the flight. The Dispatcher then sends this information to the Station Manager at the appropriate airport who in turn provides the information to the Lead Ramp Agent, or Team Leader. At some operations, this is called a "Frag," abbreviation for "Fragment" of the entire flight dispatch package.
To answer your question,when the ground crews at various airports (Sao Paulo, in your experience) show up for work, the Ramp Agent--or Team Leader--knows exactly which tail number is going to which destination, whether or not an alternate airport is required, the required fuel load, expected number of passengers (including any non-revenue passengers), catering requirements, sometimes the name and number of flight crewmembers, and occasionally the routing of the flight to the destination as well as the flight time. Once an aircraft (ship number) has been assigned to a particular flight on a specified day, it cannot be changed without specific approval from Maintenance Control and Flight Dispatch (i.e.,neither the ground crew nor the flight crew can just say, "Hey, let's send this one to New York and this one to Atlanta today).
This process does not happen by accident--it is a comprehensive, pre-coordinated, well developed system that has been perfected over years of operation.