Human perception is not as reliable as we might think. The brain takes shortcuts to handle the overwhelming quantity of information constantly provided by the senses. That creates blind spots and other perceptual illusions that are intuitively exploited by magicians to fool their audience.
No matter how intricate magical tricks can be, magicians always rely on the same set of principles: palm, ditch, steal, simulation, load, misdirection, and switch.
In the first video below, magicians Penn and Teller show how it is done.