TLDR: Rating change after a match depends on your personal rating and your opponent's team MMR. If your personal rating is equal to your opponent's team MMR, you will gain exactly 12 rating if you win (or lose exactly 12 rating if you lose). If your personal rating is higher than your opponent's team MMR, you will gain less rating when you win and vice versa. The exact calculation is more complicated for very large and very small rating changes. MMR works similarly to personal rating, but changes more rapidly.
The type of rating system used in WoW arena is known as an Elo system. This system was originally developed for chess by the Hungarian-American mathematician Arpad Elo. The purpose of the system is to quantify the skill of individual players based on how well they do against other players. The Elo system also provides a formal framework for calculating how much rating should be gained or lost by beating players of certain ratings. There are, however, a number of critical differences between chess and WoW arena which have meant that the arena rating system has received a series of idiosyncratic tweaks. One such difference is that arena is done as part of a team, where the different team members may have very different abilities. In the early days of WoW, there were arena teams that implemented a more straightforward Elo system, and rating was assigned to the teams, not individual players. In modern WoW, each player has a personal rating that is completely independent from that of your team mates. Another important difference between WoW and chess Elo is that WoW has a matchmaking rating (MMR), which is used to match your team against another team. The matchmaking rating is independent of your personal rating, and fluctuates far more than your personal rating. The reason for this is in large part so that strong players with low rating don't get stuck playing weaker players for a prolonged period of time.
For an individual player, there are (usually) only two factors that determine how your personal rating changes following a game: your current personal rating and the team MMR of your opponents. If your personal rating is equal to your opponent's MMR, you will gain exactly 12 rating if you win. You will also lose 12 rating if you lose. If your personal rating is 100 rating lower than your opponent's MMR, you will gain 15 rating if you win and lose 9 rating if you lose. This relationship between how much rating you gain or lose and the difference between your personal rating and the opponent's MMR is shown below.
Let's take the left plot first. This shows how your rating changes when you win. Suppose, for example, that your current personal rating is 1700. Your opponent has a matchmaking rating of 1750. Your personal rating is therefore 50 rating lower than their MMR (-50 on the plot), and so if you win, you will gain 14 rating. If you lose, on the other hand, we can consult the plot on right. Looking at the same rating difference (again -50), we can see that you would lose 10 rating.
The astute observer will have noticed that the plots have rather limited range. For example, what happens when you win against a team whose MMR is 500 rating above your personal rating? In the arena rating system there are a number of custom rating change modifiers that come into play for extreme matchups. In the above, we've cut off the plots roughly at the rating that the rating change modifiers start operating. These modifiers are implemented by Blizzard and are intended to change rating gained or lost in a more player-friendly way. In the case when you beat a team whose MMR is far higher than your personal rating, a \(4\times\) modifier is applied in the rating change calculation, meaning you will gain up to 96 rating per win. Similarly, if you win against a team that has far lower rating than you, you will often gain no rating from the win. This is not predicted from the standard Elo system and is a result of the hidden modifiers. These modifiers are complicated and rather opaque, and not all of them can be worked out fully from data available to players. This likely means that the modifiers use hidden values such as personal matchmaking rating to determine whether or not certain modifiers should be applied. I've provided a rating calculator which is intended for people to get a better intuition of how rating is gained and lost, but do keep in mind that you may get different results in arena games due to the presence of these modifiers. In the arena games I have played, this calculator gives a correct answer more than 95% of the time.
*Hidden modifiers apply. These use data not available to players to determine the exact calculations.
Each player has a personal matchmaking rating (MMR). This personal MMR is not directly visible to players. Instead, we can see the team MMR after each game, which is the average of the two players' personal MMR. It is this team MMR that is used for matchmaking purposes. Two players who both have a personal MMR of 2000, will have the same team MMR as a team where the two players have personal MMRs of 1800 and 2200; for both teams, the average MMR is 2000. Consequently, these two teams are likely to be matched together.
MMR differs from personal rating in two key ways. The first is that there are no complex modifiers that operate on MMR. In this regard, MMR is a much more pure Elo system than personal rating. The second is that MMR changes far more rapidly than personal rating. In the context of an Elo rating system, this is known as the K-factor: MMR has a much higher K-factor than personal rating. Our current best estimate of the K-factor of these two systems is 24 for personal rating, and 56 for MMR. This means that when you win against a person with equal MMR, your MMR will go up by 56/2 = 28. As previously noted, for personal rating, the rating gained is 12 when winning against an opponent whose MMR is the same as your PR. The rating change curves for MMR (assuming a K-factor of 56) are shown below.
This is admittedly not an exhaustive treatment of arena rating as implemented in WoW. In large part this is because we don't know all the details of how these systems are implemented. For example, in the Shadowlands pre-patch, there was a bug for players who hadn't played any games in the previous season. The logic implemented was (presumably) that if you hadn't played any games in the active season (and rated inter-season games don't count towards that), then you will be matched with players using a placement MMR. Both your MMR and your CR could go up or down, for the entire duration of the pre-patch you would always be placed in games using your placement MMR. The placement MMR is whatever value Blizzard happens to use as a default (and seems to be around 1800). There will be many other intricacies like this that have been developed over the many years that arena has been in play, but I hope I have been able to map out the key components of the rating system.