How do they find this number? By guessing at random. The hash function makes it impossible to predict what the output will be. So, miners guess the mystery number and apply the hash function to the combination of that guessed number and the data in the block. The resulting hash has to start with a pre-established number of zeroes. There's no way of knowing which number will work, because two consecutive integers will give wildly varying results. What's more, there may be several nonces that produce the desired result, or there may be none (in which case the miners keep trying, but with a different block configuration).
Let’s start with what it’s not doing. Your computer is not blasting through the cavernous depths of the internet in search of digital ore that can be fashioned into bitcoin bullion. There is no ore, and bitcoin mining doesn’t involve extracting or smelting anything. It’s called mining only because the people who do it are the ones who get new bitcoins, and because bitcoin is a finite resource liberated in small amounts over time, like gold, or anything else that is mined. (The size of each batch of coins drops by half roughly every four years, and around 2140, it will be cut to zero, capping the total number of bitcoins in circulation at 21 million.) But the analogy ends there.
Claiming to be the "world's most popular digital wallet," boasts more than 24 million wallets and has supported more than 100 million transactions. Security is a top priority, and with many longtime cryptocurrency enthusiasts comfortably keeping their spoils there for years, even as Mt. Gox and Bitfinex were breached, it would have to be.
At this point, the actual mining begins. In essence, each miner now tries to demonstrate to the rest of the network that his or her block of verified payments is the one true block, which will serve as the permanent record of those 2,000 or so transactions. Miners do this by, essentially, trying to be the first to guess their block’s numerical password. It’s analogous to trying to randomly guess someone’s computer password, except on a vastly larger scale. Carlson’s first mining computer, or “rig,” which he ran out of his basement north of Seattle, could make 12 billion “guesses” every second; today’s servers are more than a thousand times faster.
The proof-of-work system, alongside the chaining of blocks, makes modifications of the blockchain extremely hard, as an attacker must modify all subsequent blocks in order for the modifications of one block to be accepted.[81] As new blocks are mined all the time, the difficulty of modifying a block increases as time passes and the number of subsequent blocks (also called confirmations of the given block) increases.[64]

The receiver of the first bitcoin transaction was cypherpunk Hal Finney, who created the first reusable proof-of-work system (RPOW) in 2004.[21] Finney downloaded the bitcoin software on its release date, and on 12 January 2009 received ten bitcoins from Nakamoto.[22][23] Other early cypherpunk supporters were creators of bitcoin predecessors: Wei Dai, creator of b-money, and Nick Szabo, creator of bit gold.[24] In 2010, the first known commercial transaction using bitcoin occurred when programmer Laszlo Hanyecz bought two Papa John's pizzas for 10,000 bitcoin.[25]