A spell slot represents a character's potential for casting spells each day. Each spell slot is associated with a particular class and spell level; casting a spell consumes a matching spell slot. Spell slots are restored upon resting. All classes other than bards and sorcerers must assign a spell to a spell slot before it can be used. After such an assignment is made, the slot is considered consumed until the next rest, so these assignments are often made right before resting. Assignments persist until the player explicitly changes them or until the slot is lost for some reason.
Spell slots are granted to characters based upon class level, with the exact allotment listed in each class' article (labeled as "spells per day"). Additional spell slots are awarded for a high casting ability; these are listed as "bonus spells per day" in the ability modifier article. Bonus spell slots can also be granted by certain items. Additional slots for a high casting ability are restricted to those spell levels for which the character has at least 0 spell slots on the basis of class level (that is, excluding those spell levels with "-" slots), while bonus spell slots directly from an item are not so restricted.
Spell slots can be denied to characters based upon casting ability. Spell slot levels are limited to the character's current (modified) and base casting ability minus 10.
Every spell-casting class technically has spell slots for levels 0 through 9, even though the quasi-casters (bards, paladins, and rangers) are never given the upper level spell slots on the basis of class level. Those higher slots can be awarded by an item though, which could allow metamagic to be applied to the quasi-casters' highest level spells. This may require those spells to be flagged as usable with metamagic and (if the metamagic is to have effect) possibly to have metamagic support added to their scripts.
When spell slots are gained — which can occur by equipping an item, increasing a casting ability, or gaining a level — they are initially unassigned, even if those slots had been previously assigned then lost. (Hence, spells like owl's wisdom cannot be used effectively to gain additional spell slots since spell effects are removed upon resting.) When spell slots are lost — which can occur by unequipping an item, lowering a casting ability, or losing enough experience points to drop a level (quite rare) — they are lost right-to-left, as viewed in the spellbook. For classes that do not prepare spells (bards and sorcerers), consumed spells are always assumed to be "to the left", so repeated increases and decreases in spell slots will eventually cause such a caster to run out of spell slots.
Since all items are unequipped when a caster changes form, such as through wild shape or shapechange, using a form-changing ability can be detrimental to spell slots. This is particularly noticeable when a caster has both items that grant bonus spell slots and items that grant a bonus to a casting ability. One way to (partially) offset this loss of spell slots is to cast an ability-enhancing spell before changing shape. For classes that must prepare their spells, the bonus spell slots from the increased casting ability will be the first ones lost when items are unequipped.