The first thing to know about preparing spells: not every class has to do it. Some (examples: bard, sorcerer) simply know a set number of spells and can cast any of them until they run out of spell slots of the appropriate level. Others (cleric, wizard) must prepare spells.
The second thing to know: a class that has to prepare spells will select them from a larger set of spells. For a wizard, this set is recorded in a spellbook. For other classes that prepare, the larger set is any of the class spells listed in the Player's Handbook or other source books.
The third thing to know: the player decides after a long rest which spells from the larger set to prepare for the coming day.
The fourth thing to know: casting a prepared spell costs a spell slot.
The fifth thing to know: there is one exception. A spell with the ritual tag, if cast as a ritual, does not cost a spell slot.
The sixth thing to know: the character cannot cast any spell which is not prepared for the day.
The seventh thing to know: there is one exception to this as well. The wizard can cast a spell with the ritual tag, as a ritual, even if the spell is not prepared. Other classes, even if they have ritual casting, cannot do this. A spell with the ritual tag, if cast as a ritual, does not cost a spell slot, regardless of whether the spell is prepared or not.