Here are 3 strategies and the general tradeoff is between ease and cost. Ease is about how much work you want to do; there is a tradeoff because doing more work will probably save more money.
To keep this discussion clearer, "pay"/"price" is about the price per gas. Gas limit is discussed at the end.
The easiest is to think of the maximum price you are willing to pay for the transaction, and set
MaxPriorityFeePerGas) to that value. The most you will pay is
MaxFeePerGas. (The priority fee you end up paying will be lower than
MaxFeePerGas, because the
BaseFee is paid first.)
On the other spectrum, if you want to optimize your prioritization, then it requires analyzing what's in the txpool, having many nodes to listen to new transactions as they come in, and making projections and estimates based on that data. Using a very simple example, if at a point in time you see that the highest
MaxPriorityFeePerGas is 1.234 gwei, if you set your
MaxPriorityFeePerGas to 1.2340001 (and a high enough
MaxFeePerGas), then your transaction is the most profitable based on these alone, so chances are high your transaction will be included in the next block. You probably just want to be included in the block, so if you find that the median
MaxPriorityFeePerGas of all the transactions in the txpool and incoming to your nodes is 0.3 gwei, setting yours to this median value should also reliably get your transaction in the block, while saving money. These are just initial ideas as you start analyzing and optimizing. More nodes, connected to more peers, will also get your transaction around the network faster.
In the middle ground, you can search online for Ethereum gas estimators and gas prices, and set your
MaxPriorityFeePerGas) to the value they suggest at that time.
Note: the gas limit can also affect the priority of your transaction:
Does Gas Limit have any bearing on transaction/mining time?
Does using a very high gas limit somehow get your transactions executed slower?