Usually it's the result of some sort of pact; we work together, you get the stage I get the leader's jersey - a few from recent memory include Ribeiro and Cabreira on Senhora da Graça, Menchov and Piepoli on Cerler, Contador and Rujano on Großglockner, and perhaps most extremely Valverde and Szmyd on Mont Ventoux, when Valverde practically had to stop to let Szmyd past.
Here, it's different really; Serpa can say that Rujano is his leader and so he's not going to work to distance his own teammate, in which case he's effectively the guy playing monitor over the break to give Androni some insurance. Serpa and Niño hadn't been working together. Occasionally you will see somebody who's winning a race gift a stage in similar circumstances - last year on Monte Naranco in Asturias, Tino Zaballa attacked Javi Moreno over and over again for the win, but Moreno held on. It was the last stage, and Moreno had already won a stage, so he sat up at the sprint to let Zaballa get the stage win, on the basis that he was going to win the race and felt Zaballa deserved it.
Serpa also has his undefeated streak on this finish to defend, of course.