Nearly all bitcoin transactions include transaction fees that compensate the bitcoin miners for securing the network. Fees serve as a security mechanism by making it economically infeasible for attackers to flood the network with transactions. Transaction fees are collected by the miner who mines the block that records the transaction on the blockchain. Transaction fees are calculated based on the size of the transaction in kilobytes, not the value of the transaction in bitcoin. Transaction fees affect the processing priority, meaning that a transaction with sufficient fees is likely to be included in the next block mined, whereas a transaction with insufficient or no fees might be delayed, processed on a best-effort basis after a few blocks, or not processed at all. Transaction fees are not mandatory, and transactions without fees might be processed eventually; however, including transaction fees encourages priority processing.
Source: Mastering Bitcoin 2nd Edition; Antonopoulos, A.; 2017