There are several components to the phenomenon that is thumbstick drift, but we can split them into two different categories: hardware and software.
The input of the thumbstick mechanism as stated earlier is displayed as both an X and Y axis. These two axis are mechanically controlled by two potentiometers, so by moving the thumbstick you allow electricity to flow across an axis for an input to be read by the controller. Popular testing
methods read these inputs on an (X,Y) graph, with values 0 to ±100 representing the percentage of input. At rest (0,0), there is no electricity moving across the axis, resulting in 0% movement in both the X and Y direction. And by moving the thumbstick a 5% difference-from-center left and up, we would read an input of (-5,+5).
As for software, we'll discuss the two common ways video games read and interpret these values when translating them to your characters movements in-game: Deadzone Settings and Response Types.