I'm new to blockchain and trying to figure out what determines/controls the transactions that are included in a new block.
If I understand correctly, miners pull from pending new transactions in the mem pool. But;
1. What determines if they choose 1 or 10 or 50?
The solo-miner (or mining pool) typically runs software that makes the decisions. They can often configure that software in any way that they like.
In the case of Bitcoin, they are required to include AT LEAST one transaction (the transaction that pays the block reward). Beyond that they can include as many or few valid transactions as they like as long as they don't exceed any size limits on the block.
Since the miner gets to keep the transaction fees of all the transactions that he includes in his block, there is a financial incentive for him to include as many transactions as possible and to choose the transactions that pay the highest fee per byte.
2. What determines which transactions are chosen? Most recent? Highest fees?
The solo-miner (or mining pool) typically runs software that makes the decisions. They can often configure that software in any way that they like.
Since the miner gets to keep the transaction fees of all the transactions that he includes in his block, there is a financial incentive for him to include as many transactions as possible and to choose the transactions that pay the highest fee per byte.
3. Is there some reason for not choosing as many as possible to get more fees?
It takes some time to choose transactions and generate the merkle tree, and the more transactions the longer it takes. In general this amount of time is VERY small in comparison to the time it takes to complete the proof-of-work, but a miner may choose to include less transactions if he wants to get started on the proof-of-work sooner.
It is also possible that a miner may not have access to a complete list of pending transactions, and therefore will simply build a block with the transactions that they have available to them at the time.
4. Is this something you configure according to some criteria in your mining software
If you are solo-mining, yes.
or some thing determined by your pool?
If you are mining in a pool, yes.