Actually, the OS can be 64-bit because the CPU (Pentium or AMD equivalent) supports 64-bit mode. That means a Pentium internally has 64-bit registers (usually by combining two 32-bit registers, i.e. you have half as many of them available to use), 64-bit datapaths, and its ALU can execute 64-bit operations. Its floating-point unit probably goes up to 128 bit. Chip vendors like Intel and AMD are relatively free to add these features whenever they please, so long as they also add a bit of emulation to talk to 32-bit memory buses.
The rest of the hardware (motherboard, i.e. memory bus, off-chip cache, etc.) probably is still based on the old 32-bit standard, because it's hard to get a consensus among competitors to evolve a standard simultaneously. But that's not a terribly big deal. The CPU can always fake 64-bit double word accesses just by issuing two accesses for 32-bit words. It's surely a little slower than a native 64-bit memory bus, but since we don't have a 64-bit platform to compare side-by-side, we never realize what we're missing.
- It's not much slower because Pentiums thru Core i7 already pre-fetch 16 bytes = 128 bits for every instruction, which completely trumps the 32/64 bit distinction. This is because Pentium is CISC (complex instruction set computing), with variable-length instructions, and the longest Pentium instruction is 15 bytes(!!). Hence it always fetches the minimal chunk divisible by 4 that is guaranteed to contain 1 full instruction. If it actually contains 16 tiny instructions of 1 byte each, well yay, it skips the next 15 fetches.
- If some of those instructions then demand more data memory accesses -- OK, you pay a slowdown for that subset of fetches. Even then, your L2/L3 cache kicks in, and their cache block sizes are large enough that they're probably hauling in 64-byte chunks from memory anyways. So the old 32-bit memory bus might never actually see a bald 32-bit memory request from the CPU -- there's many layers of smarter hardware in between, which has already increased the grain size. So the extra cost of two 32-bit requests vs. one 64-bit request may be almost nil, amounting to one more cache hit.
Hence, Win 7(?) and Win 8/8.1 come in distinct 32-bit and 64-bit versions, and your same PC will run all of them (but only 1 at a time), regardless of its motherboard architecture. You can even hot-install a 64-bit Win 8.1 from within 32-bit Win 7 (I did that), since it just copies files under Win 7(32) until the first reboot, then re-awakens in Win 8.1(64).
- You do need a non-ancient generation of Pentium to support Win 8.1 (either width) because it must provide NX, i.e. chip-level non-execute flagging of every memory page. This is a modern security feature against buffer overruns and other cracks that rely on sneaking code into your stack segments, then tricking your call stack to return into it. Microsoft's Windows upgrade checker will test your CPU and tell you the highest version of Windows it can support (which is 8.1 if it has NX, and 7 if it doesn't).
So: upgrade (or cross-grade) to the 64-bit version of your current Windows. You could also upgrade to 8.1(64) while you're at it, but that's not necessary; Win 7(64) suffices.