On a board, Ana and Bob start writing $0$s and $1$s alternatively until each of them has written $2021$ digits. Ana starts this procedure and each of them always adds a digit to the right of the already existing ones.

Ana wins the game if, after they stop writing, the resulting number (in binary) can be written as the sum of two squares. Otherwise, Bob wins. Determine who has a winning strategy.
1. **Understanding the Game Setup:**
   - Ana and Bob write digits alternately, starting with Ana.
   - Each writes 2021 digits, resulting in a total of 4042 digits.
   - The resulting binary number is evaluated to see if it can be expressed as the sum of two squares.

2. **Analyzing the Binary Number:**
   - The binary number is formed by alternating 0s and 1s, starting with Ana's 0.
   - The sequence will look like: \(010101\ldots\) for 4042 digits.

3. **Bob's Strategy:**
   - If Ana writes a 1 at any point, Bob can mirror her moves to ensure the final number has pairs of zeroes at the end.
   - This results in a number that, when divided by 4, leaves a remainder of 3 (i.e., \(4k+3\)).
   - Numbers of the form \(4k+3\) cannot be expressed as the sum of two squares.

4. **Optimal Moves for Ana:**
   - To avoid giving Bob an advantage, Ana should avoid writing 1s.
   - However, if Ana writes only 0s, Bob can still force a win by writing 1s in the last three turns.

5. **Final Moves:**
   - Bob can ensure the final number is \(10101_2 = 21\).
   - The number 21 cannot be expressed as the sum of two squares.

6. **Conclusion:**
   - Bob has a winning strategy by ensuring the final number cannot be expressed as the sum of two squares.

\[
\boxed{\text{Bob wins}}
\]