How does SR work gain / loss work?

Here is the full textbook on skill rating: