When is the bitcoin reward provided to the miner?
The reward is just a transaction which payers the miner, called a Coinbase transaction. Thus it only pays the miner if that transaction is in the accepted blockchain, i.e. if it was invalid or if another block was found first that block would not be included so the miner would not be paid. In fact coinbase transactions only mature after 100 blocks have been mined on top of them, to avoid miners spending coins straight away and then a reorg happens and the block becomes a fork