Your second way.
"... by adding together all your levels" would mean that your second example (ranger + paladin)/2 rounded down is how you'd work it. The rule doesn't have you segregate the levels before dividing if they are the same category. The example given in the book is a case of two different categories being combined, otherwise it would not have arrived at 5th level.
In your example, the result is 2 on the table, giving you 3 first level spells total for both this level and the next level you attain (be it 3/2 or 4/1).
The categories boil down to four the way the rules are presented:
*Note: (Thanks @Nick) As a practical matter, for both Ranger and Paladin, some DM's will rule that you would use the multiclassing spell rules once you are level 2 since both of those classes have their spellcasting feature come on line at 2d level. (See the tables and class description for each class). Ruling that once spellcasting is 'turned on' by one class it is always on will not break the game.
Eldritch Smite is Warlock slot only
Only warlock spell slots from the Pact Magic feature can be expended to use Eldritch Smite; spell slots from the Spellcasting feature do not work with it.
An unofficial tweet by rules designer Jeremy Crawford in November 2017 confirms that this was intentional (unlike the paladin's Divine Smite, which had similar wording initially but was changed in errata later to work with any spell slot):
Talking about Eldritch Smite; can you only use Warlock spell slots to power it, or can you use any slot (à la Divine Smite)? The RAW on it specifies Warlock slots.
Eldritch Smite works with warlock spell slots only—the ones you get from Pact Magic.
Best Answer
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:
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:
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:
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:
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:
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.