Spells typically have a flat damage roll depending on level. Spells that use spell slots usually can also be cast using a higher level spell slot than the spell itself, increasing its damage. Some spells may instead increase in damage based on character level. A few spells will also add your spell casting ability modifier to the damage.
If the spell's level spell slot is available, it will use it. Otherwise, it will use a higher level spell slot if available.
#tip