Replace-by-fee is a technique that allows replacing one version of an unconfirmed transaction with another version of a transaction that pays higher transaction fees. RBF was first introduced in BIP125 and its implementation was released in Bitcoin Core 0.12.0. 

Various node software uses different RBF rules causing several variations. BIP125 opt-in RBF as implemented in Bitcoin Core 0.12.0 is the most commonly used RBF today. This version of RBF allows the transaction creator to indicate that they’re willing to allow their transaction to be replaced with a higher-paying version

An unconfirmed transaction can stay as it is forever. It means as long as there are people who are paying higher transaction fees, your unconfirmed transaction can stay as it is and will never be included in a block.  

You are running short of time, so you broadcast another transaction. This new transaction is similar to the previous one, but it includes higher fees. When miners select this transaction, they will receive higher fees. Now, your transaction is more competitive in the market for block space. Wallets like Electrum and Blockstream Green allows an easy way to use RBF.