Keep your chain clean and lubricated, especially if your bike has derailleurs.
There are two reasons to lube a chain: to make pedaling easier and to preserve the life of the chain. There are various approaches, and there is no perfect way to do it. I use a simple technique. Lean the bike upright (or have someone hold it up, or suspend it on a bike work stand). Make sure that the pedals have enough room to spin the cranks. Sit or stand in front of the right (drive-side) of the bike. Turn the cranks backwards with your right hand and squirt oil in a continuous stream on the chain with your left hand as the chain passes by your left hand. Do this for several turns of the crank. Then hold a rag in your left hand and wrap it around the chain. Grasp the chain in the rag firmly enough that you'll be wiping the chain but loosely enough to let the chain slide through the grasp. Again, do several turns with the crank. Turn the rag to a clean spot and wipe again. Repeat this until the dirt spot created on the rag becomes a bit cleaner. This can take five turns of the rag or so. If the chain is still dirty, start again with a new application of oil. This way, the oil is washing the dirt and grime. Wipe again, about five times. This whole process usually takes me less than a minute, sometimes two.
There are various types of oil, each with its advantages. The thinner it is, the more frequently you have to use it. Some oils attract more dirt than others. Sometimes I use oil that bike shops sell, because it's handy, but generally, I prefer automatic transmission fluid, available at an auto parts store. It's inexpensive and does a very good job. Lately, I've been using chainsaw oil, because it is thicker (more viscous) and therefore requires less frequent application. I use a squeeze bottle with a very thin nozzle so I can apply small amounts at a time.
I could spend more time on it to get more dirt out, and doing so would preserve the life of the chain. Some would argue that I'm pushing dirt into the tiny invisible places where it counts the most. They could be right. But I replace my chains frequently. Some would call it prematurely. I don't enjoy cleaning chains, so my approach, while arguably wasteful, is gentle on my bike. A worn chain will wear the sprockets, which are much more expensive than the chain. If my chain shows the slightest sign of elongation, I replace it.
And since I replace chains frequently, I don't need to buy expensive chains. I've been happy with KMC chains, which are the least expensive of the good chains. I've occasionally bought SRAM or Shimano chains on sale, but only because the price is good. If KMC chains are not as durable as other brands, I substitute quality with vigilant replacement. Since I am preserving my sprockets this way, and since I keep it clean enough to reduce friction, this plan works for me.
If you prefer to buy expensive chains and go through the trouble to soak them in solvent to remove every bit of grit, that's fine, too. My days of soaking and scrubbing are done.