As the title my question is how they earn bitcoin by mining?
As every other have responded, from block reward and by including a transaction on a block and receive incentives from the transaction fees.
Is it only from the block rewards or they also get btc for the validation of transactions?
Both are possible ways they can earn, but the beauty of it is that mining is not as that easy as you may thought, because the task needed to earn this comes with solving complex arithmetic, not to talk of setting up a rig.