This is the mining section from the book Mastering Bitcoin. It is a very detailed explanation of how bitcoin mining works. I suggest you give it a read and you will understand how bitcoin mining works.
I also suggest that you don’t try to mine until you understand how it works, how the market is doing, and what it takes. At least, if your goal is to make money / be profitable. Many people have lost money trying to mine, and many of them said that they would have gotten much more sats if they had just bought bitcoin instead of trying to mine it.