I am confused.
What I learned is that "ci" replaces a noun or sentence preceded by "a", "in", ""su", and "con". Ofcourse when they are things and not persons.
Non c'è nessuna limitazione per i sostantivi animati: si può dire "ci parlo" (parlo con lui); "ci vado" (vado da lui) ecc.
However, "ne" replaces a noun or phrase preceded by ""di" or "da".
All good till now.
I am reading on the pronome "ciò" and that phrases like di ciò, da ciò, in ciò, a ciò, su ciò and con ciò are interchangable/replaceable by ci and ne. But "ci" and "ne" do not follow that first rule I learned in the examples they provide. These are the examples I found in my grammer book (Dardano):
-Deduco
da ciò che non siete stati attenti

ne deduco che non siete stati attenti
-Cosa guadagni
da ciò? 
cosa
ci guadagni? (This is not according to the rule)
Perché in realtà "cosa ci guadagni?" viene da "cosa guadagni con ciò?"
Se fosse "cosa ne ricavi?" allora sarebbe "cosa ricavi da ciò?"
Why is that? Is the ci-ne rule I learned a right one? What are the exceptions and how can I know when to use which?