Can someone explain video game licensing to me?

Alright, so here's my question: how come some games have cars and tracks that others don't?

For instance, Porsche. Somehow, Forza managed to temporarily get the Porsche license to make a DLC pack for Forza 4, however, now they don't have the license for Forza 5, or Forza Horizon/ Horizon 2. Porsche also isn't available in the Gran Turismo games, either. I understand that EA has the license, so they "own the rights" to put Porsche's cars in their games, so they put them in Real Racing. So that part makes sense to me (kind of) but here's the other part of the question... How can Forza, Gran Turismo, AND EA all have the rights to put, say, Ferrari in their games? If Porsche can only be in one title, how can Ferrari be in multiple?

Can someone explain how this whole thing works? How can one brand be exclusive to one game, but another brand be used by multiple games?