I've googled and youtubed and read lots of posts, I think I have an idea of what's going on.
I got this e61 a few months ago and at the time, the remote was working intermittently.
After a lot of reading, I checked all the usual suspects. The antennae box under the spoiler was well sealed, no water or corrosion.
Then I pulled all the wires in the 2 harnesses on the drivers side hatchback door hinge.

The harness that went down to the main door had a number of broken wires. I fixed them and then the rear window latch started working, the rear hatch door was able to unlatch again, it's like everything was magically fixed.

The harness that went up to the spoiler (still on the drivers side hinge) has only 2 wires: a thick black wire and a thick brown wire. There was a third hose which I assume was the squirter for the rear window, that's not leaking.
The brown wire was broken, I fixed that.
From what I've been reading, that is the wire that drives the remote key fob antennae function.
But unlike all the other fixed wires, this didn't fix the problem.

I have not checked the passenger side hinge wires yet. All the lights on the hatch door work so I'm thinking those might be okay.

I plugged in my little foxconn scanner and it doesn't have much to say, all the keys were enabled, and it says when you want to add a new key, it just magically works. A few youtube videos said the same thing. By turning the car on and off a few times the key gets programmed to the car.

No such luck for me.

So the only thing I can think is that I got bad information and some wires on the passenger side are what is wired to the antennae or something else is broken and I have no idea what.
It's possible the rechargeable battery in both key fobs (I have two, tried both) are bad? but it used to work (as I said intermittently which is what led me to the broken wires) only a few months ago so I'm thinking it's something else.

Also it's probably worth noting that I brought the car to the dealer about a month ago where they did the trunk water leak fix and replaced half the back of the car to fix all the fried electronics modules. So maybe there's something related to the fuse box that needs to be poked? any particular fuses I should look for?
Maybe a relay somewhere?

Thanks for any help you can provide.