Each pool operator sets two fees, fixed fee and margin. The fixed fee determines the number of ADA coins the operator receives each epoch if the pool is eligible for a reward. A pool gets a reward if it creates at least one block per epoch. The fixed fee minimum is set by protocol at 340 ADA coins and is not changed by most operators. Margin is a variable component given as a percentage of the remainder of the pool reward after the fixed fee has been deducted. The total stake of a pool consists of ADA coins of the pool operator (pledge) and delegated ADA coins. Based on the size of the pools, the element of luck and the success rate of block production, the Cardano protocol calculates the rewards for the pools in each epoch. The protocol first calculates the reward for the pool operator and then the rewards for the stakers. Rewards for stakers are calculated proportionally to the number of ADA coins they have delegated to the pool. Let's take an example. A pool operator has a fixed fee set at 340 ADA coins and a margin set at 2%. The pool receives a reward of 30,000 ADA coins. The first 340 ADA coins are deducted, leaving 29,660 coins. 2% of 29,660 is 593.2 ADA coins. Pool operator gets 340 + 593.2 ADA coins, which is 933.2. There are 29,066.8 ADA coins left for all stakers, which will be split proportionally. The Cardano protocol is fully responsible for calculating and distribution rewards for pool operators and stakers. The reward for stakers is distributed after one epoch has elapsed from the end of the epoch in which the ADA coins were used.