In upcoming Marvel film Avengers: Age of Ultron, they are using Quicksilver and Scarlet Witch, characters which are Mutants (X-Men). So has Fox agreed for the characters to be used or Marvel and Fox both own the rights for these X-Men characters?
Quicksilver and Scarlet Witch are a special exception to the licensing of the Mutant portion of the Marvel universe to Fox. Due to them being mutants, but also being important Avengers, both companies retain partial rights to the characters. Fox can use them as mutants and children of Magneto. Marvel can use them as Avengers, but they can't mention they're mutants or mention Magneto.
Kevin Feige said:
Characters like the Scarlet Witch and Quicksilver, are they part of Fox's deal or are they characters you could use?
Feige: We both have them. There's a specific arrangement with those two characters that would allow us to use them with "Avengers," but not discuss or reference their mutant or Magneto-related lineage. They can use them as mutants and as Magneto's relatives, but cannot have anything to do with "The Avengers."
Legally, 20th Century Fox may object to the use of characters it is producing. So Marvel and Fox may both end up in suing soup due to some characters if one of them decides to sue the other. Though my opinion would be that both firms lawyers and management would negotiate the films and scripts to get a way out of this. Its just power play to get leverage over the other studio. You can read up more on Marvel Studios deals with other studios to get a good picture about how much of Marvel characters are actually licensed outside itself.
No, because Scarlet Witch and quicksilver are owned by fox. They made a deal with marvel to use them as long as they don't mention mutants or X-Men and vice versa. Same with spiderman and Sony