To obtain the UDP checksum, add up all the words of the packet using one's complement addition. What makes one's complement addition different from other binary addition we have done is what the computer does with the overflow bit and there is an additional final step. If the leftmost bit gets an overflow, that overflow bit gets added into the rightmost bit. For example, 1000+1000 = 0001 for that step of one's complement. Finally, at the end of the one's complement addition, we invert the final sum.
To check the checksum, we add the checksum to the the non inverted sum of the words and check to make sure it is all ones.
If we are sending the packet 1011 1001 0001, this is how we would compute the checksum
CALCULATING THE CHECKSUM
1011+1001=0101 -> In this step, we had to carry the overflow bit, to the rightmost bit
1001 is the checksum
CHECKING THE CHECKSUM
The sum is all ones, so the message is correct