Tango is danced in sets, called tandas. A tanda is made up of either three or four songs, depending on the location of the event.
All the songs within a tanda will be of the same subgenre, and the playlist at milongas (dance balls) are usually set up in the form of: Tango, Tango, Vals, Tango, Tango, Milonga...on repeat.
When you accept a dance with a partner at a milonga, you finish a tanda with them (unless your partner breaks the códigos).
Each tanda is separated by a cortina, or a song that is obviously not from tango. This signals partners to break and find new partners.
The códigos, or the codes of tango, are the unspoken etiquette that keep the dance community enjoyable and functional. They evolved over time, and form the backbone of milonga culture.
Actions that are in line with the códigos:
dancing in tandas.
following the counter-clockwise ronda, or circular line of dance, without holding up traffic or cutting in front of another pair of dancers.
using the cabeceo or the mirada, where leaders and followers ask each other to dance through glances and not verbal questions. This allows both sides to decline a dance without public embarrassment.
Actions that are against the códigos:
cutting across a dance floor
teaching or demonstrating at a milonga
doing high kicks or other risky moves in a crowded event
asking your partner to modify their style to suit you
Lastly, walking off in the middle of a song is a signal to the audience that something inappropriate has occurred during the tanda, and can be used to keep the community safe :)