The details are pretty complicated, and way beyond me. But I deal with it to some degree professionally and have worked with a galvanic corrosion engineer
on a number of projects.
The fundamentals are pretty easy, and don't really require a lot of understanding, just following the rules.
1) use the same metal whenever possible
2) where two different metals touch isolate them where possible with a non-conductive material in the middle.
3) sacrificial anodes are a good thing. But must have an electrical connection to what they are going to protect.
There are a few other rules derived from these.
1) NEVER use aluminium wire on a boat. It is so low on the galvanic chart that the wire can actually act as an anode. Which can then break the electrical connection to what we thought was the anode
2) loctite is your friend, use it on threads, but also anywhere else two pieces of metal touch
3) just because two things are aluminium, doesn't mean they have the same galvanic potential, so get out the loctite.