Block height refers to the total number of confirmed blocks in the history of a specific blockchain network – including the genesis block (block zero), all the subsequent blocks up to the latest one, plus all the blocks after the latest one, inclusive. Unlike the last block, every block contains a hash (digital signature) which links the previous block to its predecessor, so that the hash can be used as a link between blocks in the chain.
A new block can be identified by its hash being higher than or equal to the previous most recent block. But the fact that each block has a hash, regardless of its age, does not guarantee that particular block is in the chain at all times. Every time a new block is created, a new hash is produced, with the previous hash now considered invalid.
One of the primary factors that determines the validity of any new block is its hash, and the likelihood of that hash being valid also depends on the difficulty of finding previously validated blocks (the difficulty is defined by the network, and updated automatically). However, other factors, such as the date, time, and place, may also influence the validation of blocks. For example, recent blocks are considered to be more reliable since they have been generated during the last two hours (in the case of block explorers). The time and date are not only used by network nodes but also by miners who choose to mine a certain block based on its current status. Thus, a single mining pool can decide which blocks to include in a particular chain, determining how much power it can gain from the network.
One of the ways that miners try to add to their chances of getting the last block of a given chain is by creating invalid blocks. These blocks would never be accepted by other miners, meaning that the other nodes have no means of knowing about them and thus will not accept them as valid blocks.
When a valid block is found, it becomes part of the chain, and its hash is added to every previous block in order to increase its chance of being included in the next one. As the blocks get farther from each other, the chance of an invalid block increases, until eventually it reaches a maximum, called the longest valid chain, at which point it will be considered as a block for which miners stop building, since it is impossible for anyone else to mine on it.
If no miners ever build on an invalid chain, the valid chain will be considered as “end of history” and no longer mined. It will never be reorged or re-propagated because there will be no more work to do.
Because a valid chain is a long lasting and stable one, the fact that a single block was built on the longest valid chain is actually a very rare event. Most new blocks are still built on the new longest valid chain. But on occasion, a new block will be found on the new shortest valid chain, but it will be removed from that chain due to a malformed transaction, an unimportant block, or a malicious attack by someone who wants to cause confusion. Even when this happens, the longest valid chain is likely to be reorged.
When it comes to block explorers, a block explorer is basically a web page where you can view all the blocks for a given height, enabling you to see which blocks are being accepted by the network and which blocks are still up for grabs. You can also see which miners are working on which ones, allowing you to see which transactions are still being made, which ones are being spent and which are still in the validating process.