Residential Capital LLC won court approval to sell its mortgage-servicing unit to Ocwen Financial for $3 billion after putting off a fight with loan investors and resolving other objections.