Close, but not quite.
I assume you're asking how the "mining" works, and that's actually pretty easy to explain.
Each bitcoin block is generated with a SHA256 hash of the block's header. Presumably, the header information is not guessable, otherwise it would be pointless.
The SHA256 hash becomes the "target." In order to successfully mine the block, you must produce a hash with a value lower than the target. The lower the target, the harder it is to mine the block.
The "target" is in fact the difficulty. Essentially a difficulty of 1 means an applicable proof-of-work block solution would be less than 2^256 >> 1 (I could be wrong on the max size, I'd have to look it up). A block "solution" is a sha-256 hash of (merkle root (which is generated by doing a merkle tree starting with the transaction IDs of all the transactions since the last block) + some other header stuff + a nonce). The header stuff is completely public and known. The "work" miners to is generate trillions upon trillions of those nonces (which is just a word for a random piece of data), calculate the sha-256, and see if the resulting sha is less than the target.
Successfully mining a block is essentially like winning the lottery because there is no known way to make educated guesses about what text might produce a hash below the target's value.
Once an acceptable hash has been generated by a miner, it is submitted to the network with a proof of work that permits the rest of the network to essentially check the solution. At that point, the block is considered completed, the transactions are processed, and the successful miner is awarded the transaction fees plus 20 new BTC.
It's fees + 25 BTC. But that will change eventually, as we approach the max of 22 million BTC in circulation.
I don't think the rainbow table comparison is apt because you're not attempting to produce hash collisions, only find hashes below a set value. Finding a collision is exponentially more difficult, by design.
A "rainbow table" in this case would have to have a number of entries greater than the size of particles in the known universe, I think. We're talking about stupidly large numbers here.