When a connection is opened, each end sets a sequence number in its initial SYNs
When data is sent from one end to the other, the sequence number is incremented by the number of bytes sent
If the other end got the data, it updates the acknowledgement number in the packets it sends back
If data gets lost, the sender notices that the acknowledgement numbers it's getting back aren't increasing, and resends the unacked data
Packets can arrive out of order, and sequence numbers are used to assemble them in the right order
A recently-implemented SACK extension allows a host to indicate that it didn't receive a specific range of sequence numbers in a connection, allowing faster recovery from dropped packets