I understand the steps for converting to and from two's complement. Represent the number as a positive base binary value, flip the bits, add 1. I don't understand why adding the 1 actually works though. Also, I get that we're adding the 1 to remove the negative representation of 0. That's sort of irrelevant to my confusion though.
It feels like when you add one after converting, then add one when converting back, the 1s shouldn't "cancel" like they do, but they do. Is there some nice proof or some simple logic to make sense of this?
Let's say you are working with $n$ bit quantities. In binary, the various patterns of $n$ bits represent integers in the range $0 \ldots 2^{n} - 1$. In 2's complement we want to reassign some of these $2^n$ bit patterns to represent negative integers and to have about half of the bit patterns represent negative integers (so the range of numbers we can represent is roughly symmetrical). What we do is map the integers in the range $-2^{n-1} \ldots 2^{n-1} - 1$ into the range $0 \ldots 2^{n} - 1$ by the function $t(x)$ defined as follows: $$ t(x) = \left\{ \begin{array}{l@{\quad}l} x & \mbox{if $0 \le x \le 2^{n-1}-1$}\\ 2^n + x &\mbox{if $-2^{n-1} \le x < 0$} \end{array}\right. $$ and then use the binary representation of the non-negative number $t(x)$ as the representation of $x$. This works out nicely, because addition of numbers in the range $-2^{n-1} \ldots 2^{n-1} - 1$ maps to addition modulo $2^n$ (i.e., adding and discarding the carry bit).
Now flipping the bits of an $n$ bit binary representation maps $x$ to $2^n - 1 - x$ (because $2^n-1$ is represented by the bit pattern with all $n$ bits $1$ and then the subtraction of $x$ gives you a $1$ where $x$ has a $0$ and a $0$ where $x$ has a $1$). So, if $x$ is in the range $1 \ldots 2^{n-1}$, the 2's complement representation of $-x$, i.e., the binary representation of $t(-x)$ is obtained by flipping and adding $1$, because $$ t(-x) = 2^n - x = \underbrace{2^n - 1 - x}_{\mbox{flip}} + 1 $$