Sometimes an effect will grant a creature the ability to roll a d20 more than once for a single check. It is also possible for multiple effects of this type to be in play at the same time. The specific source of this effect will specify the conditions under which it applies (such as needing to decide whether to reroll before the result of the roll is known).
If an ability allows a creature to roll an additional die and take the better result, or forces a creature to roll an additional die and take the worse result, the rolls are made simultaneously if possible or sequentially if not, before any other effects are allowed to be applied. If a creature is influenced by multiple such effects, determine the total number of dice to roll by comparing the number of beneficial dice to the number of detrimental dice and roll all dice simultaneously if possible. The number of additional dice is determined by adding 1 for each additional die allowing the creature to take the better (or best) result, and subtracting 1 for each additional die forcing the creature to take the worse (or worst) result. If the final number is positive, roll that many additional dice and take the best result. If the final number is 0, roll only the normal dice. If the final number would be negative, roll the negative number worth of dice and take the worst result.
If an ability allows (or forces) a creature to reroll a die, it may specify whether this must be done before the final result is known (meaning success or failure is announced) or may allow the reroll to take place after the result is announced. If the ability allows the reroll to take place after the result is announced, it can turn a success into a failure or a failure into a success. If multiple dice would have been rolled and a reroll takes place, all dice are rerolled according to the rules of the reroll (taking the better or worse result). If the reroll does not specify whether to take the better or worse result, use the same rule as the original roll for this purpose.
Example: A class feature allows a character to roll twice for his attack roll and take the best result, and also receives the benefit of a spell which allows him to roll twice and take the best result. The character is also affected by a condition that forces him to roll twice and take the worst result. The final roll would be +1 dice, +1 dice, and -1 dice, resulting in 1 additional dice. The character would roll 2d20 for his attack roll and use the higher die result for the final roll. However, a nearby creature casts a spell as a Reaction that forces him to reroll and requires him to take the worst result. Now the character rolls 2d20 and for his attack roll and uses the lower die result for the final roll.