I am having a hard time understanding the details of how blocks are getting created by miners while many transactions are being received by various nodes at slightly different times and what information from these broadcasts get combined with a nonce to find the target to satisfy the proof of work.
Let's say that Alice sends Bob 1 BTC. This transaction gets broadcasted to the entire network of miners who will then verify that transaction is correct and proceed to try and find a nonce to create a block with all other transactions that they have received.
However, there are many transaction broadcasts happening simultaneously. Transactions can arrive at different nodes at different times due to latency. How does each individual node know how many and what transactions to include in the block? What happens to transactions that arrive to the node while the block is being "mined"? Or do new transactions get added to the block while it is being mined? What data from the transactions gets combined with a nonce and hashed to find the target?