Uber reported its first quarterly profit ever this week. Here's a look at how it got there.