When stored digitally, audio is a bunch of data points where each data point is an amplitude sample and an associated time that it occurs at.
To speed something up (or slow it down) you just change the time that the sample occurs at (i.e. decrease or increase the time between each sample).
It's the digital equivalent of literally turning the casette tape reel or vinyl record faster (you know what those are right?)
It's almost identical to just hitting the notes on a piano faster when reading sheet music.
But unlike a piano where you are just speeding up when the notes play rather than the sound of the note itself, everything will also sound higher pitched since all signals are composed of a bunch of sinusoids superimposed (stacked up) on each other via Fourier analysis (which you might not have heard of yet seeing as your profile says you are quite young) so when you play everything in the signal faster you are basically running through the constituent sinusoids faster which makes them higher frequency.