It is entirely up to the pool operator or solo miner to select which transactions to include. A pool, or solo miner, is aware of all transactions in their mempool. They build a block from these transactions and then start looking for valid hashes.
So what goes in a block depends first of all on what the solo node or pool has accepted into its mempool and then on which transactions they selected from their mempool. If you want the details see
https://bitcoin.org/en/developer-guide#mining.
The only restriction on blocks is that pools or solo miners must only build a block that will be accepted and relayed around the network. For block rules see
https://en.bitcoin.it/wiki/Protocol_rulesFor what mempool will include see such parameters as mempoolexpiry, mintxfee and minrelaytxfee.
Remote 'Miners' using a central pool only calculate sha-hashes as directed by the pool operator. They do not know block contents. A hardware miner such as an S7 is simply calculating sha-hashes values for the pool operator or solo miner.