I want to know the whole proccess by which we can earn through mining.what happens in mining?
You calculate hash (cryptographic function) that is confirmation of transactions in next block.
Simple as that, you need more details, read everything about mining out there

i recommend bitcoin documentaries also.