Is the transaction size relevant if fee per byte is the same? Is the size of the transaction some factor when the miner chooses one transaction over the other, provided that they both have the same fee per byte?
In other words, will the miner prefer larger or smaller transactions if they all have the same fee per byte?
TL;DR: Usually not.
Bitcoin holds a lottery to elect the author of the next block roughly every ten minutes. The participants enter by performing hashes on block candidates (&quot;buying lottery tickets with power expenditure&quot;). The &quot;winning ticket&quot; is found when a miner finds a valid block. Whatever (valid) set of transactions the miner had in their block candidate gets appended to the blockchain. The block includes a transaction that collects the block subsidy and transaction fees and pays it out to the block's author. This &quot;distributed lottery&quot; is used to rate limit updates to the system's shared state, giving everyone time to converge on a single ground-truth. While the block's content must fulfill the rules of the network, the actual selection of transaction for the block happens before consensus is established and is therefore each miner's sole prerogative.
Generally, miners get paid more when they include the transactions with the highest feerate first. If the feerate of the two described transactions is in the range of the next block, they should include both. If only one fits, they should pick the one that maximizes the transaction fees collected from the transactions that fill the remaining space in the block block. If only one fits, presumably preferring the bigger transaction would usually yield more total transaction fees, but for that to matter, the two transactions would need to fall right at the end of the next block.