Uber posted a profit of $394 million during the second quarter, compared with a loss of $2.60 billion a year earlier. That came in better than the $18 million loss that analysts polled by FactSet had expected and was driven predominantly by its operating profit, which totaled $326 million.