Righty-ho, I’ll try to keep this reasonably short
I’ll start with a link that’ll answer the OP’s question:
https://cyclingtips.com/2018/05/chain-cleaning-and-maintenance-how-to/
This is a solid summary of the main ways to clean your chain, from the simple and lazy to complex and slightly bonkers.
However, I would say that if you want a clean chain this isn’t what you should be looking for.
To take a slight detour, wet lube is the source of all evil in your drivetrain. The problem is that, as we all know, dust and grit and filth sticks to wet lube. A brand new chain turns into a black, greasy mess after a few hundred Ks. You can clean it the best you can, but as we’ve all seen once you relube it and run it through a clean cloth that lube will have drawn out old lube and grit from inside the rollers and it’s suddenly not as clean as you’d thought.
That grit and dust sticks to the lube and is transported inside the chain, into the rollers. It’s this that wears the chain - it’s basically grinding paste, right? And a worn chain then ‘stretches’, which wears your cassette and chainrings. Ergo, wet lube destroys your drivetrain.
Time for another link to a CyclingTips article:
https://cyclingtips.com/2020/05/how-many-watts-does-a-dirty-chain-steal/
If you aren’t racing you aren’t too worried about losing a few Watts, I hope, but those lost Watts are going to one place and one place only - friction, which = wear, which = a worn drivetrain.
Now, there is a solution to all of this: wax.
https://cyclingtips.com/2018/03/fast-chain-lube-that-saves-you-money/
Wax is a brilliant lubricant for your chain because at any sensible temperature for riding it’s a solid, so it’s sit inside the rollers of your chain and be a great lube, but it won’t absorb dust and grit, it doesn’t move into and out of the rollers like wet lube does so any dust and grit that lands on the chain won’t be transported inside it anyway, and because it’s dry and, er, waxy it stays clean. No filth on your chain, no filth on your cassette or chainrings, a spotless derailleur, and no chainring tattoos.
So to answer the question above, how does this waxing thing work? This is a great in-depth piece:
https://cyclingtips.com/2020/08/how-to-wax-a-chain-an-endless-faq/
I’ll give a short summary.
1: Clean your chain until it’s spotless. Ideally start with a new chain fresh from the box, and strip it back to bare metal. I have five jars of solvents, stepping through meths, turps, and acetone getting cleaner with each step. By the end of this it’s spotless.
2: Get some wax. I use Molten Speed Wax, but as far as I know just paraffin will do the job. The fancy stuff has Teflon etc which may or may not make any difference. I also got some nice stickers. YMMV.
3. Get a slow cooker, crock pot, or whatever you call it in your neck of the woods. This will prevent you from burning your house down. Wax + heat = fire risk. I got mine for like $5 from a second hand store.
4. Melt the wax, stir in your chain, simmer gently, then pluck it out and hang it up to cool.
5. Put your chain on your bike, ride, smile, feel virtuous, tell everyone about how you now wax your chain.
6. When you need to re-wax your chain, whip it off, rinse off any dirt that’s on it, let it dry, and dump it back in the melted wax. Sorted.
I have three chains that I wax, and I rotate them - so I’ll wax them all at once as that takes no longer than just doing one, then have the others as spares so I can swap them out as required. Swapping a chain with a quick link takes less time than a squirt of wet lube so once you’ve up and running this is pretty quick and easy.
So that’s my spiel. Waxing is far and away the cleanest way to lube your chain that I know of, it’s really low maintenance, and reduces wear significantly.
And on a slightly unrelated note, not all chains are the same and more expensive chains can last a hell of a lot longer:
https://cyclingtips.com/2019/12/the-best-bicycle-chain-durability-and-efficiency-tested/
Any questions? Fire away!
Stephen