Operating systems don't detect the CPU architecture. Instead, you have to ensure that you install the correct version of the operating system given its CPU architecture. If you make the wrong decision, then the OS won't boot, as the CPU won't understand (either reject or misinterpret) the machine code that you've provided.
The reason's that an operating system is just a program written as a series of instructions for the CPU to execute. Since different types of CPU's have different instructions, a procedure (program) written (compiled) for one CPU could be gibberish for another.