I am studying the algorithm of Bitcoin and I don't understand one thing. If all miners are mining the next block at the same time, and there are thousands of nodes, how could it be that there are no collisions (two blocks found at the same time)? I wonder how effective this process is? As I understood the algorithm, the mining must be sequential (with order), and this can only be done if all miners mine the next block at the same time, because hash of the previous block must go within the next block. But if they mine it at the same time, there must be a lot of collisions. However I can't find anything about collisions or low effectiveness of this blockchain algorithm.
Every miner tries to mine a different block. One reason is that the reward payment address (which pays the miner for their work) is naturally different for each miner. Therefore, no two miners are competing to mine the same block.
Similarly, each individual miner changes other things in blocks to make sure that each of their mining rigs is not duplicating work too.
I found a study about inefficiency of blockchain here
Blockchain Inefficiency The Bitcoin Peers Network Giuseppe Pappalardo 1 , 2 Guido Caldarelli 2 Tomaso Aste1 1University College London
Bitcoin blocks average one per 10 minutes. A block takes a few (let's say 10) seconds to propagate in the network, and then miners are working on the new block. So this leaves you with about 1/60 chance each time that a miner will find a block that gets orphaned.
This also means that 1.7% of the hashrate gets wasted, but that's pretty insignificant.
The way these orphan blocks are handled are the heart of Bitcoin's innovation. The "Longest Chain" rule is its defining feature - it seems from your question that you are not aware of it, which suggests you do not understand the protocol.
Anyway, if we try to shorten the time between blocks, orphaning becomes a more significant problem. That's why Aviv Zohar et al have been working on alternative protocols which are immune to this problem, GHOST and now SPECTRE.
Your understanding of the way blocks are assigned is incorrect. There is no guarantee (initially) that all nodes will unilaterally agree on the same next block to be added to the chain. Dispute situations are relatively common, and stem from multiple miners solving the next block close enough to simultaneously in order for some nodes to receive one candidate for the next block from one of the miners, and other nodes to receive a different suggestion.
The longest chain solution solves this dilemma by reverting the entire chain to the suggested block + any further blocks added, once one of the disputing chains has been mined at a faster rate than the other and so becomes longer.
So there are “collisions”, however the system inherently deals with these situations algorithmically.
How effective this system is.. well in 9 years there hasn’t been an instance of system failure, because of this potential threat, or any other. The mathematical security built into blockchain as a whole is far superior to any previous digital currency conceptions, which all had issues with one or more of these potential threats which they could not solve. Blockchain is a highly complete solution, not just to trustless decentralised value transfer, but to many other applications which are only really possible because of a few key securing features, such as the longest chain concept, digital signing etc