Mind you that some pools may use custom implementations that apply different logic to decide which transactions to include. As long as all transactions included in a block are valid, it is up to the miner to decide exactly what to include and what to leave out.
Thanks for your reply, that's great and really helpful.
I can see from the source code that the miner try to include transactions from the memory pool. If I understand correctly the main.cpp line 3888 populates the memory pool with transactions. Are these messages with the strCommand value "tx" transactions from p2p clients such my wallet when I send BTC to some one? If yes, does it mean that many miners would include my transaction and the lucky one who finally get the block will put the block that includes my transaction into the block chain?