Always check that your chain is lubricated. Metal chains need to be lubricated regularly. (Ignore this if your bike uses a carbon fiber belt.) An unlubricated chain will wear out faster than a lubricated one and can also damage the rear cogs. If the cogs go from being triangle to looking like shark fins, they need replacing.
Lubricate chains every few rides depending on mileage. Methods vary. You can place a drop of chain oil on each connection point or simply rotate the cranks rearward and lay a stream of oil along the length of the chain. In either case, before applying the oil, hold a clean heavy paper towel or lint free cloth gently around the chain and SLOWLY let the chain slip through, removing oil and debris on the surface of the chain. Then apply the oil.
Let it sit for a few minutes and then very lightly hold the paper or cloth around the chain as you SLOWLY crank backwards again to remove excess surface oil. Too much oil on the surface will attract dust, dirt and debris.
Generally, use chain oil marked “dry” for dry conditions and chain oil marked “wet” if you’ll be riding in rain, mud, rain puddles or on wet roads. Some oils claim to be suitable for all conditions. Experiment and see what works for your bike. While a small minority will disagree, always use an oil labeled as bicycle chain oil. Be aware that original WD40 is not suitable. WD40 has a bike chain specific oil clearly labeled for bike chains and is safe to use.