Warlocks are able to use a certain number of spell slots each day, which are determined by their spellcasting ability score. A Warlock’s spellcasting ability score is the sum of their Intelligence and Charisma scores. A Warlock’s spell slots are determined by their spell level, which is based on the Warlock’s level in their class.
A Warlock starts with three spell slots at first level, and gains an additional spell slot for every two levels after first. The maximum number of spell slots a Warlock can have is six.
A Warlock can cast any spells they know without preparing them ahead of time, using their currently available spell slots. They can also cast prepared spells if they have the required number of slots available.
However, if a Warlock uses up all of their available spell slots, they cannot cast any spells until they gain a new slot or prepare a new spell.
Some Warlocks choose to specialize in one type of magic, such as fire or lightning magic, and may find that they need more than the standard amount of spell slots to cast the spells they know. Other Warlocks may find that they need fewer slots to cast the spells they know, depending on the type of magic they specialize in.