Where does the decimal to binary "Divide by 2" algorithm come from?
The algorithm follows fairly directly from our usual representation of numbers. Since most of us are more familiar with decimal, let's start there. Let's pick a number--say, 937. Since this is decimal, this means 9 * 102 + 3 * 101 + 7 * 100. So, repeatedly taking the remainder after dividing by 10 gives us the digits.
If we convert to binary, that's 11'1010'1001, because 937 is 1 * 29 + 1 * 28 + 1 * 27 + 0 * 26 + [...] + 1 * 20.
Just like in decimal, taking the remainder with repeated division by the number base we care about (2 in this case) gives us the digits of the number, starting from the least significant and progressing to the most significant, because that's pretty much how we define the representation of a number in a particular base.