"Very carefully! Okay but if you actually want to know, let's talk about binary logic, first.
"...no, actually, let's talk about the Jacquard loom, before even that. I'm not sure how the fuck mechanized sewing works, even less than printing, but industrialized weaving was the first programmable machine - you could tell it to lay a thread, or not, via holes punched in a card.
"This paved the way for the initial design of the Turing machine: a wholly mechanical device that could do math by manipulating binary (a number system that counts zero, one, one-zero, one-one, one-zero-zero, or off, on, on-off, on-on...). I believe it may have been steam-powered, but regardless of whether you could hand-crank it, and now that I think about...no, the ENIGMA machine was powered. Anyway, I'm pretty sure it remained mostly a theoretical curiosity to mathematicians until the proper introduction of electricity - which is, broadly, bottled lightning - a while further on, though my understanding of that era is somewhat foggy save for that Turing himself was around to do codebreaking during a definitely-electrified war.
"Regardless.
"After that war's long since over, people much smarter than I dust off the ol' Turing machine, and put that together with the more recently popularized field of semiconductors, instead of sticking with the early-computing-era use of vacuum tubes, yes, you heard me correctly, they used the absence of stuff to store data somehow - anyway. Semiconductors are invented, and suddenly, you can make a computer that's not as big as this room do something useful.
"So someone takes the desktop mechanical calculators that got put into stores to sum up prices and such, figures they can put that into handholdable silicon real easy and that people would want one, instead of having to use things like slide-rules, and starts the company that makes this calculator.
"Theoretically you can do arbitrary computing on it but I never learned the programming language this thing uses and I don't have an electrical generator, so I'm not going to waste power trying to learn.
"...I never did actually explain how it does math, did I, just that it does.
"Do you actually want me to try? I probably can't reconstruct math from the basics of hardware logic, I should warn you - NANDgame kicked my ass when last I tried to play the damn thing, and the whole premise of that game was doing that."