Memories can be removed from the head of a witch or wizard and placed into a vessels known as a Pensieve to be viewed and studied. After removal, memories can be tampered with, as Horace Slughorn did when he tried to revise and conceal his own memory of teaching Tom Riddle about Horcruxes.
They can also be seen in the minds of others through Legilimency.
The Memory Modifying Charm is used to erase or “Obliviate”a person’s memory, especially Muggles who have accidentally caught a glimpse of the magical world or been harmed by it in some way.
Magizoologist Newt Scamander discovered that the venom of the Swooping Evil creature could have a healing effect on bad memories (WFT).
In the MACUSA Death Cell, a prisoner's good memories are removed and dropped into a pool of Death Potion. The accused sits on a chair that is slowly lowered as their own memories lure them to their own execution (WFT).