Multiclassed casters learn/prepare spells as if single-classed in each class.
The multiclass spellcasting rules in the PHB (p. 164) or basic rules clearly address how known and prepared spells work if multiclassed into 2 or more classes (or subclasses) with the Spellcasting feature:
Your capacity for spellcasting depends partly on your combined levels in all your spellcasting classes and partly on your individual levels in those classes. Once you have the Spellcasting feature from more than one class, use the rules below. If you multiclass but have the Spellcasting feature from only one class, you follow the rules as described in that class.
Spells Known and Prepared. You determine what spells you know and can prepare for each class individually, as if you were a single-classed member of that class. If you are a ranger 4/wizard 3, for example, you know three 1st-level ranger spells based on your levels in the ranger class. As 3rd-level wizard, you know three wizard cantrips, and your spellbook contains ten wizard spells, two of which (the two you gained when you reached 3rd level as a wizard) can be 2nd-level spells. If your Intelligence is 16, you can prepare six wizard spells from your spellbook.
Each spell you know and prepare is associated with one of your classes, and you use the spellcasting ability of that class when you cast the spell. Similarly, a spellcasting focus, such as a holy symbol, can be used only for the spells from the class associated with that focus.
If a cantrip of yours increases in power at higher levels, the increase is based on your character level, not your level in a particular class.
As explained above, when you multiclass into multiple spellcasting classes, you determine your known and prepared spells as if you were single-classed in each of those classes. (This includes cantrips, which are spells with a spell level of 0.)
Note that some class/subclass features (such as the Lore bard's Additional Magical Secrets, clerics' Domain Spells, or paladins' Oath Spells) may provide additional known or prepared spells that are not counted against your number of known/prepared spells for that class. If this is the case, the description of the class/subclass feature will tell you whether or not these spells are counted against your limit of known/prepared spells.
What about warlocks?
You may note that the rules I've quoted so far mention the Spellcasting feature in particular, so you might wonder how they interact with warlocks, who have the Pact Magic feature rather than the Spellcasting feature. On that topic, the multiclass spellcasting rules merely state:
Pact Magic. If you have both the Spellcasting class feature and the Pact Magic class feature from the warlock class, you can use the spell slots you gain from the Pact Magic feature to cast spells you know or have prepared from classes with the Spellcasting class feature, and you can use the spell slots you gain from the Spellcasting class feature to cast warlock spells you know.
Technically, they don't mention how known spells are determined for warlocks multiclassed with another class at all, only how multiclassing interacts with their Pact Magic slots and which slots can be used to cast warlock spells. However, based on the stated logic, and the absence of any rules to the contrary, it seems clear: your known warlock spells are determined as if you are single-classed as a warlock, just as with any other caster class.
Rules designer Jeremy Crawford unofficially confirms that this is the rules intent as well in a series of tweets from December 2017:
Cleric Spellcasting feature says you can prepare spells up to your spell slot level. Pact Magic gives you higher level spell slots. can a level 1 Cleric/5 Warlock prepare Animate Dead? since Warlock has no spellcasting feature, doesnt use multiclass prep rules
Multiclass spellcasting. You determine the spells you know/prepare for each class individually, pretending you have just that class. The slots you get from the multiclassing rules don't apply. You have 1 level in cleric? You prepare cleric spells as a 1st-level cleric.
"If you multiclass but have the Spellcasting feature from only one class, you follow the rules as described in that class." Warlock doesn't grant the Spellcasting feature, so it'd follow the Cleric "spells must be of a level for which you have spell slots." Is that still wrong?
Keep reading, starting with the next sentence: "Spells Known and Prepared. …"
"If you have the Spellcasting feature from more than one class, use the rules below." In this case, I wouldn't have the Spellcasting feature from more than one class, so the rules below for Spells Known and Prepared wouldn't apply.
Keep going, all the way down the page. You'll get to the "Pact Magic" section, which tells you how Pact Magic interacts with Spellcasting. It has no effect on what you can prepare.
The spellcasting feature doesn't mention where the spell slots have to come from.
Now that you've re-read the multiclass rules, let's go to the cleric. The first sentence of "Preparing and Casting Spells" reads "The Cleric table shows how many spells slots you have to cast your spells …" That initial text sets the stage for what follows in that rule.
"The spells must be of a level for which you have spell slots." The text in Preparing and Casting Spells doesn't explicitly state that it only applies to Cleric spell slots though. I don't feel like the first line restricts you in that way.
When writing that rule, I began it with that sentence for a reason: to contextualize everything you read after it in that rule. Sentences in our rules are not meant to interpreted in isolation from each other.
Thus, it's clear that determining known/prepared spells when multiclassed into warlock is meant to work the same way as with any other combination of spellcasting classes.
A note on artificers
The artificer class, added in Eberron: Rising from the Last War and to the final version of the Wayfinder's Guide to Eberron, works slightly differently from other classes when it comes to multiclassing. However, this distinction is only in terms of determining spell slots: you add half your levels, rounded up (E:RftLW, p. 54; WGtE, p. 176), instead of down, when using the multiclass spellcasting table to determine how many spell slots you have as a multiclassed artificer.
In terms of determining the spells you know/prepare, the artificer simply follows the general rule: you determine what spells you know/prepare individually, as if single-classed in each class. As such, for determining how many artificer spells you can prepare, you simply follow the rules in the artificer's Spellcasting feature (E:RftLW, p. 55-56; WGtE, p. 177-178).
Moving back to the example:
For instance, if I am playing a multiclassed character with 1 level in warlock, 2 levels in bard, and 3 levels in paladin, how do I determine which spells I know/have prepared?
We must look at each class' spellcasting feature and class table to determine how many spells known or prepared you have for each class:
The Warlock table shows that a 1st-level warlock knows 2 cantrips and 2 more spells. And per the Pact Magic feature, "At 1st level, you know two 1st-level spells of your choice from the warlock spell list." (When you learn a new spell or swap out an existing spell for a new one at higher warlock levels, your new spell would need to be of a level no higher than that of your Pact Magic slots.)
Per the Bard table, a 2nd-level bard would know 2 cantrips and 5 more spells. As with the warlock's Pact Magic feature, the bard's Spellcasting feature says your non-cantrip spells must be a level for which you have spell slots; as the Bard table shows, a 2nd-level bard only has 1st-level spell slots, so all 5 must be 1st-level spells.
Finally, paladins prepare their spells instead of knowing/learning them. The paladin's Spellcasting feature says you can prepare "a number of paladin spells equal to your Charisma modifier + half your paladin level, rounded down (minimum of one spell)". It adds that the spells must be of a level for which you have spell slots; per the Paladin table, a 3rd-level paladin only has 1st-level spell slots. Let's say your Paladin has a Charisma score of 16, and thus a Charisma modifier of +3. This means that you can prepare a number of spells equal to your Charisma mod (3) plus half your paladin level (3/2, rounded down to 1), for a total of 4 spells.
However, that's not all. At 3rd level, paladins get the Sacred Oath feature; each oath grants them oath spells at specified levels. Your oath spells are always automatically prepared, and don't count against the paladin's number of prepared spells (and are always considered paladin spells for you). The Oath of Devotion paladin's Oath Spells at paladin level 3 are protection from evil and good and sanctuary. This brings your actual number of prepared paladin spells to 6.
Thus, as a warlock 1 / bard 2 / paladin 3 with a Charisma score of 16, you:
- know 2 warlock cantrips and 2 1st-level warlock spells
- know 2 bard cantrips and 5 1st-level bard spells, and
- have 4 1st-level paladin spells prepared, plus 2 always-prepared oath
spells specified in the subclass description (e.g. protection from
evil and good and sanctuary for a Devotion paladin)
You would not have access to 2nd-level or higher spells in any of these classes unless you took at least 3 levels total in warlock or bard, or at least 5 levels total in paladin.