Casting most spells spends a spell slot of the spell’s level or higher, and you regain all your slots on a long rest. Casting a spell with a bigger slot often makes it stronger — that’s called upcasting. Cantrips never use slots; you can cast them at will.
How many slots you get depends on your caster type. Full casters (Bard, Cleric, Druid, Sorcerer, Wizard) advance fastest — a 1st-level slot at level 1 and their first 9th-level slot at character level 17. Half casters (Paladin, Ranger) start at level 2 and cap at 5th-level slots; third casters (Eldritch Knight, Arcane Trickster) start at level 3 and cap at 4th.
Warlocks are different: their Pact Magic gives a few slots that are always your highest level and come back on a short rest, which is why they cast fewer spells but refresh them far more often.