Since the merge we have predictable block times of around 12-13 seconds. I want to broadcast my transaction in a way that it is highly likely to get included in the next mined block, e.g. the block 15565595 got mined, i broadcast my transaction right after and it should get included in block 15565596. However, when i look at my confirmation times on etherscan (time first seen and included in block) they are all higher than 13 seconds, despite setting appropriate gas fees (max fee - base fee with overhead + priority fee > 5 gwei and the block mined before being at ~50% gas usage) and the transactions are all included in the block after next block. I am using the go-ethereum client to sign transactions. Is there some parameter i have to specifically set or unset to make this happen?
The progradation of transactions to the network to be validated and the propagation of newly validated blocks to the network is not instantaneous.
When you send your transaction to a node to be broadcasted to the network, first the node will validate and make sure the transaction is valid, then it will send it to its neighbor nodes, which in turn will do the same until it is broadcasted through the network and reaches validators. At this point, chances are that some validators already gathered transactions to start validating and will not include any more transactions in their blocks, even though they may have plenty of transactions in the mempool but their block may be already full. They validate that block and broadcast it.
Your transaction could get into this block or wait for the next. So, probably there's nothing we can do to make sure that our transaction will certainly be added in the next block. Many things are happening. Sometimes it will, sometimes it won't.
One thing you could try is sending a higher gas price. This will increase the chances of your transaction being included in the next block, but will not ensure it.