As I understand it, there are two sets of rules, for two scenarios:
If someone gives you control of their units (while they are still in the game), you can command the units and buildings as you like, but you cannot do anything that requires minerals or gas. So you can attack, lift off, change rally points, etc, but you cannot build buildings or train troops. You can use energy (do a scan, call down a MULE), but your resources always stay separate (the MULE will gather minerals for them, for example).
When you get control of someone's units because they've left the game, you can do all the above, but now you can also spend minerals and gas. You can build buildings, train troops, etc. The resources come out of your bank, but this is because when the ally leaves, their resources are split among remaining allies, and their further income gets split among you too.
Although you are spending "your" resources, the buildings and troops remain that player's for gameplay purposes. Pylons will make energy fields for them, not you. Depots will raise their supply cap, not yours (and they can be supply capped even if you're not).
- If an ally gives you control, you can help micro their troops. You can't help with macro much though.
- If an ally drops early, make sure to send their workers harvesting, and train more. It will cost you some minerals, but you will get lots back from the split harvest.
- If an ally drops late, you can basically take over for them, building bases and troops and waging war. At the very least, you can add their remaining troops to your army.
Many times the enemy will ignore the dropped player, which can come back to bite them, because their base may yield a ton of resources for you, and they may have a sizable army waiting in the wings.