How exactly do these work? If I agree to a mining treaty, and they build a mine on one of my asteroid belts, does that mean then that I can not build a mine on that same asteroid belt? Does it become a race with my ally to see who can build mines on things first?
Each asteroid or strategic resource source can still contain only a single outpost, so only one of you can benefit from it. Yes, you are effectively racing the AI to put outposts down in one another's territory. They can place them in your territory, and you can place them in theirs.
I typically reject them if the AI requests them, but I sometimes request them myself. The reason to do so would be to gain access to an untapped strategic resource that is in their zone of control. With a mining agreement, I can send my outpost ship in to establish an outpost on it and claim that resource for myself. Typically I haven't left any of them in my territory for the AI to take. I may leave them some asteroid belts as I am less concerned with claiming all of those by the mid to late game. The other reason to form such an agreement would be to plant an outpost somewhere in their territory to extend your logistical range, as I mentioned in your other thread. This would allow you, for instance, to move through your partner's empire in order to reach and attack an opponent on the other side of them.
That is the same thoughts i had, but it seems like a missed opportunity for the game to do something more with the mining treaties.
This is one of the flaws of the game. There really seems to be no upside and the AI constantly pesters you for it. But if you agree, it quickly grabs every asteroid belt in your empire, including your home system. Doubly annoying when you are trying to save them for planet construction.
Mining treaties will generate extra production (0.25/pop) once you have starbases with freighter ports. This is doubled with alien habitat modules. Once you've got all your resources being mined and starbases built it's a nice bonus. I wouldn't want to sign one early like the AI wants to though; unless I've got enough of a tech lead I can be confident of not having my so called friend loot my empire of a newly discovered resource before I know what it is though.
Once you have established an outpost everywhere you want one in your own territory, there is really no downside, and it opens up resources in rival territory--especially if you've discovered a hidden system the AI has not yet spotted or exploited. Also, since any military ship can capture an undefended outpost, you could always cynically allow the AI to establish outposts in your territory for you, then declare war and simply take them, saving the expense of building outpost ships yourself.