Clean your chain
Before applying lubricant, get the chain as clean as possible. There is no point lubricating over dirt as this will continue to grind around all of your key components.
If your chain is in a particularly dire state you could use a scrubbing tool, but usually a rag and degreaser will do fine. Remember to also clean in the cassette and around the jockey wheels.
The best way to apply lube is with your bike in a stand or the back wheel off the ground. Apply one drop of lube into every chain link and work the pedals around gradually until you have completed every section. Then run the bike through as many of the gears as possible to force the lube into the inside parts of the links where it is most needed.
As a new rider, leaving excess lube on the chain was the first thing I got told off for when I took my bike in for its initial service. The key place for the lubricant to be working on is the internal parts of the chain, so you shouldn’t expect to see it coated on the outside.
When you have applied the lube and run it through the gears a few times, grab an old piece of rag and gently wipe the chain down to remove any excess. This should stop too much grit being able to stick to the outside. If you have used a dry lube leave it for a few hours so it has dried out completely before taking it for a ride.
How often should I lubricate the chain?
How long is a piece of string? There are so many variables here so it’s almost impossible to say, though I work with a general rule of about once a month, maybe slightly more in bad conditions.
With experience you can feel when the chain doesn’t move so smoothly and then react accordingly. Don’t feel like you have to relubricate every time you give your bike a wash, as in the long run all this will do is cause more grime to stick to the chain.