Now the moment it is sent... only one of the two transactions will go through correct?
Both will be broadcast. They will each end up in a variable number of individual mempools, but only one will be included in a block.
If so, how would you know which one it would be?
If you broadcast to two random nodes, then you don't.
Assuming you use the same sending fee... what happens?
Both are broadcast, both end up in some mempools, only one is mined.
Is it a matter of luck?
It's a matter of which transaction has the most connected nodes and the fastest route the network to see how many mempools it ends up in. From there, it is a matter of luck which one gets included in a block, although the one which present in more mempools than the other has a higher chance of being mined.
If one uses a higher sending fee than the other... then the higher sending fee would go through and not the other one?
No. Most nodes will accept whichever transaction they see first, and would ignore a double spend even if the fee is higher (unless the transactions are flagged as RBF).
So what happens after few minutes then when you check the blockchain transaction of each one? Would one show confirmation but the other doesn't?
Depends on which transaction is present in the mempool the block explorer you are using is looking at.
Would both eventually show at least one confirmation?
No. Only one would (excluding the extremely unlikely scenario of two competing blocks at the same height, each including a different one of your transactions).
Would one of the transactions even get rejected the moment both of you click send?
If the first transaction propagated fast enough, then maybe.
What if you click send btc... but your friend takes a few seconds later to send btc? Does that mean your transaction will work but his doesn't?
As above. The second transaction would be rejected as a double spend.
What if you send it first with a low transaction fee but he sends it just few seconds later with a very high transaction fee? Does that matter?
No, unless you are opted in to RBF.
I remember there was that replace by fee with electrum that was talked about... does that apply to this?
If the transactions are flagged as RBF, then the higher fee paying one will win.
I heard this is actually called a double spend... is that correct?
It's an attempted double spend, yes.
So basically some people who want to scam would say okay I send you btc and then they send it... but they also send btc to another address at same time? So they might send you the transaction id for you to check on blockchair to see the confirmations? But the transaction they send to you... which they want cancelled... it would still show one or two confirmations... before it eventually will get rejected? Is that how it works?
No. Except in very rare cases, a double spend can only reverse unconfirmed transactions. Once a transaction has a confirmation, it is very unlikely to be reversed.
I remember someone mentioned if its small amounts you receive you only need one or two confirmations. If it's medium amount you want at least three confirmations. But if its high amounts, you want like 6 confirmations or something like that? So how many confirmations minimum do you need before you know a transaction cannot be cancelled?
There is no number of confirmations which say a transaction
cannot be cancelled. Theoretically, an attacker with enough hashpower could reverse any number of confirmations (back to the last hardcoded checkpoint). In reality, 6 confirmations is extremely difficult to reverse and can be considered final for all intents and purposes. If someone managed to reverse 6 confirmations, then the price of bitcoin would tank and your reversed transaction will be worthless anyway.
Now what if it was two different devices but you are both sending it to the same btc address? What happens there?
Exactly the same as above.