How does the resubmission of transactions work?

What are the conditions in which a transaction is resubmitted before its cancellation.
An example with speed and other parameters would be helpful, as I am unable to create a scenario like this.