When casting a spell during combat you need to keep in mind the “Casting time of a spell”
Some spells use your action for the casting time whereas some spells can be cast using a reaction or a bonus action, the casting time of a spell will be explained in the spell description. Some spells also require “concentration” to be held on the spell between rounds to keep the effects of the spell active, if a Spellcaster’s concentration on a spell is broken, e.g. if attacked by an enemy creature, the spell will end.
Once you know the casting time of a spell you should read the range of the spell to see if the enemy or area you are targeting is in range.
Did my spell hit or not?
Some spells require you to make an attack roll against A targets “Armour Class”, with a successful hit being a role higher than the targets AC. On a successful hit you would then roll for damage (which listed in the spell description).
However, some spells flip the script and require your target or any creature in your spells “area of effect” to make a saving throw to avoid the harmful effects of your spell.
To do this the “Game Master” must make a roll for the enemy and they must roll higher than your “Spell Save DC” to avoid the attack. Your Spell Save DC is always 8 + 2 + your spellcasting modifier. Your Spellcasting modifier is based off what your character class, be it, Bard, Cleric, Paladin, Ranger, Sorcerer, Warlock or Wizard, uses for their spellcasting, for example a wizard uses their intelligence as his spellcasting modifier.
For example, a Wizard with a intelligence modifier of +2 would have a spell save DC of 8+2+2 =12. This would mean if the wizard casts a spell at an enemy they may have to make a roll against the wizard’s spell save DC, rolling lower than the Spell Save DC means the enemy failed the roll and takes the hit, but a roll of equal or higher means they succeeded on the role and avoid the worst of the spell.