Preparing spells
From Monster Manual, page 10.
The monster has a list of spells known or prepared
from a particular class.
This part basicallly means that there are two options:
- monster has spells prepared (he knows even more) which resembles clerics, wizards
- monster has spells known, which looks a little similar classes of bard or sorcerer
Continueing.
You can change the spells that a monster knows or has prepared, replacing any spell on a monster's spell list with a different spell of the same level and from the same class list. If you do so, you might cause the monster to be a greater or lesser threat than suggested by its challenge rating.
From Monster Manual Errata:
The monster is considered a member of that class when attuning to or using a magic item that requires membership in the class or access to its spell list.
Player Handbook page 201
Before a spellcaster can use a spell, he or she must have the spell firmly fixed in mind, or must have access to the spell in a magic item. Members of a few classes, including bards and sorcerers, have a limited list of spells they know that are always fixed in mind. The same thing is true of many magic-using monsters. Other spellcasters, such as clerics and wizards, undergo a process of preparing spells.
Notice, that the word "many" is used, not "all". If you read Monster Manual, you will notice that there are 2 types of casting for monster: innate or one that has spells from one of the spellcasting classes. Since word "many" applies only to a part, it is clearly means, that only one part of the magic using monster does not need to prepare them. That part are monsters with innate spellcasting. The other part goes with the rule:
Other spellcasters, such as clerics and wizards, undergo a
process of preparing spells.
Morefurther, to prove my point:
Drow Mage, and Drow Priestess of Lolth are basically Drows who took some classes of wizard or cleric, since their innate magic is not so powerful(you can easily create such a character like it was a PC). Notice that both of them are not called "wizard" or "cleric" but spellcasters with prepared spells from wizard/cleric list.
If someone is still uncertain, there is a reply from wizards:
Basically this means, that you should treat the monster depending what kind of spellcasting they have.
Example:
Spirit Naga must prepare it's spells like a wizard does.
Derro Savant (Out of the Abyss, page 60) doesn't have to prepare it's spells, as he is treated like sorcerer.
Recovering spells
From Player's Handbook, page 201:
Finishing a long rest restores any expended spell slots (see chapter 8
for the rules on resting). Some characters and monsters have special
abilities that let them cast spells without using spell slots.
This means, unless the monster has a special ability to regain spell slots, it needs a rest.
Such an example would be Lich:
On initiative count 20 (losing initiative ties), the lich can take a
lair action to cause one of the following magical effects; the lich
can't use the same effect two rounds in a row:
The lich rolls a d8
and regains a spell slot of that level or lower. If it has no spent
spell slots of that level or lower, nothing happens.