RAID 5 requires a minimum of three disks in order to work. Say each disk is 2 TB, and you have four disks, for a total of 8 TB. In RAID 5, your total capacity drops to 6 TB. Why? If the "spare disk" (albeit distributed) is only storing parity bits for all your files, why does it need an entire disk to do so? It makes sense why you lose drives in other configurations, as they are usually mirrors, but this I do not understand. I also do not understand the way RAID actually works in-depth, and would like a further explanation.
The disk is not a "spare". It's used for parity information.
The data between all other drives is run through an XOR computation, the result of which is stored on the parity drive. Due to the nature of XOR, if any of the drives that were used in the computation are lost, the information can be restored from the information on all other drives.
XOR stands for exclusive or and is a binary operation which results in 1 if one and only one of the inputs is 1, otherwise the result is 0.
So let's look at an example with 3 disks. If you have a 1 on the first disk and a 0 on the second disk, you put a 1 on the parity disk.
1 XOR 0 = 1
If any of the 3 disks would go offline, running the same XOR operation on the remaining disks will return the value that was on the disk which is now offline.
? XOR 0 = 1 => 1 1 XOR ? = 1 => 0 1 XOR 0 = ? => 1