This is how I look at it.

ke joins two grammatically complete expressions, usually complete sentences, but it can include prepositional phrases, as in the first example.

Por konvinki tiun sinjoron, ke li eraras - to convince this man that he is making a mistake.

li eraras - to convince this man he is making a mistake. mi efektive tute ne volus, ke li estu tiel fidela. - In fact I would not want that he should be so faithful (I wouldn't want him to be so faithful)

The clauses are complete without ke, which is just a little bit of grammatical glue to stick them together.

Por konvinki tiun sinjoron

li eraras

Mi ne volus

li estu tiel fidela

On the other hand, kiu is actually part of the clause... it is acting or being acted on by the verb.

la rivereto, kiu antaŭe estis ruĝe kolorigita - The stream which had previously been colored red.

antaŭe estis ruĝe kolorigita - The stream had previously been colored red. La kampisto, kiu tie plugadis - The peasant who had been plowing there.

tie plugadis - The peasant had been plowing there. en la mano, kiu ilin deŝiras - In the hand which plucks them.

In every case, kiu isn't just gluing together two thoughts, it actually representes the rivereto, the kampisto, the mano.

Since kiu is actually part of the clause, it would take appropriate grammatical endings.

sceno, kiun la luno vidis - a scene that the moon saw.

Kiu here represents the scene, and is receiving the action of vidis and so needs the -n ending.

Above examples are Zamenhofaj from La batalo de l’ vivo. Translations are mine.