this is a hypothetical question with to many variables...in most cases i would take out the enemy...if my ally was a bad 1650...if he was better then 1650 i might save him if he did things like: get to classical at a usual time, built a army, constant villie production, doesn't keep idles, and gives me a sence he knows what he is doing...otherwise if he comes off as a newb whats the point in saving him? and i would rather lose one good opponent and lose one bad ally then the other way around...and it was a bad decision on the other enemy's part...
in the situation that the enemy is better...it's a matter of who can take out the others ally first...and can start the attack on the person...
if u feel the NEED to help ur friend/ally then attack the attacking enemies base...take the tc...kill some villies...take down houses...whichever of those u can do will mess him up...especially taking down houses (but if u have seige to take down tc by all means that is better then taking down houses...but u might wanna take down houses after taking the tc with ur rams/whatever and kill villies with army) ...this will make him retreat...or if he doesn't it will lose him the game ...and its a 2v1 vs the lesser opponent
but if u are currently beating the better opponent...finish him off
if enemies equal then finish ur guy off (when i saw finish i mean take down tc houses and villies u can find) then you can help ally as mentioned above...and ur ally should not resign...just go somewhere and recover (even in the enemy u are finishing offs base)
if a ally resigns it is a hurt to your game...don't do it except in extreme cases...and if worst comes to worst ur ally should just tribute u and slingshot you...but a ally gives u greater pop...and if u had that pop 2 could still micro better then one...
finally...TALK ...if u need a resource don't think "he'll think im a newb if i say i need WOOD" no...he'll you're a newb if u lose the game for him!!! if he can't give you resources he can't...and leave it at that...don't flame him...he has 2 guys already wanting to kill him...he doesn't need his ally too
anyway...it's more then what u asked and i could go on but it depends on the situation...which is why u have to think when u're playing...everyone wants to freak...and when the games get huge, instinct does take over and that's when experience comes in to play...but if u keep your head and think things through you'll win more then you lose
ESO2 name: WalksWithAngels