If I'm reading the XML correctly, what really happens is that all of your colonies and all of their colonies get a 25% bonus to the approrpriate output (research, gross income, or culture generation) that stacks additively with the bonuses from the improvements which already exist on the planet. The treaty is essentially a free market/lab/cultural center (dependent upon treaty type) on each colony you have; the economy of the faction you've partnered with has nothing at all to do with the benefits you receive, as far as I can tell from the XML. As such, unless I've misread the file, the treaties are really rather marginal in effect.
The treaties are defined in TreatyDefs.XML if you're inclined to look for yourself, by the way.
Basically this. You also need to have the tech for them, and for the econoic/science/culture treaties you need to have a relations value of at least 4 for them to appear on the list.
As to alliances... as far as I can tell they have no direct in-game effect. You just collect them for diplo victory. I think they're supposed to cause AIs to get hostile to enemies of their allies pretty quickly - the xml seems to indicate it - but I've never actually seen any such thing happen in game.
My allies do eventually DoW my enemies, but usually at the point that I've crushed them militarily, so they're probably just triggering the 'you are ripe for conquest' modifier. Certainly, lots of other empires which aren't allied to me seem to join in around the same time.