Trick switches held items with the target. It does not require both Pokémon to be holding an item, in which case the item is simply given to the target or received from it.
Switching items with wild Pokémon is permanent (received items are kept, given items are lost). All held items in Trainer battles and wi-fi/linked battles (including Battle Tower/Subway/Maison) are returned to their respective owners at the end of a battle.
Pokemon with the ability Sticky Hold cannot have their held item removed. The Griseous Orb cannot be removed from Giratina; Type Plates cannot be removed from Arceus; Drives cannot be removed from Genesect; and Mega Stones cannot be removed from their respective Pokémon.