what’s the difference between each and both?
The primary difference is that "both" can only refer to a quantity of two.
1a: I have two bicycles, and both of them need major repairs.
1b: I have five bicycles, and each of them needs major repairs.
Note that, in these examples, "both" requires a plural verb but "each" requires a singular. This is because, in this context, "each" means "every one of".
We also use "each" to refer to severally counted items as opposed to mass quantities:
2a: These onions cost a dollar a pound.
2b: These onions cost a dollar each.
If the onions are small, then (2a) is the better deal. If they are very large, (2b) is better.