A gun is not a mythological and magical device. It isn't powered by voodoo, unicorn tears, or fairy dust. It's a mechanical device that contains and harnesses an explosive force caused by burning propellant to both move a projectile and cause itself to mechanically cycle. Mechanical devices take some lube, some maintenance, and some attention to insure they continue to function reliably, especially when such devices are carried daily and subject to pocket lint, dust, sweat (salt, very corrosive), heat, and humidity.
Cleaning is deceivingly simple. If you see anything but pristine metal/plastic, clean it. Carbon is a natural byproduct of discharging cartridges, and it will be abundant in a well shot firearm. Any decent cleaning kit should include a nylon brush (old toothbrush works fine) and that will clean most loose carbon very quickly. I keep an old tee shirt handy to clean the brush itself so you aren't just smearing around dirt. A bit of cleaner or oil (more kinds than can be listed, I like Ballistol personally) may be required to loosen stubborn or baked on carbon. A brass brush may also be necessary if a little more aggressive measure is required, though care should be taken as this may disfigure a gun's finish (on internals or a stainless gun, this is obviously less of a concern). The point is to clean out any debris and dirt, not to move or disfigure metal.
Lubing is where the court of public opinion starts to weigh in, as each person's own experience comes into play. Some like to run a gun "wet", practically dripping oil. You only need to get a spritz of hot oil in your face a single time to see that isn't preferable all the time, though some will insist their gun ONLY runs when dripping wet with lube. I would argue their gun has a mechanical problem they are trying to mask. Some insist their guns can and SHOULD be run dry. Metal + metal - Lube = premature metal wear and more friction. Since most of the firearms we would consider for carry use run off of either recoil and spring pressure (modern handguns) or a myriad or small tight tolerance parts (double action revolvers) the complete absence of lube is a really bad idea. For a carry gun, I place just enough oil to lightly coat moving parts. Using a precision bottle helps to prevent over application and helps get the oil exactly where it needs to be. I typically apply oil, cycle several times, wipe everything out I can leaving only a thin smear. If a gun can't run with an absolute minimum amount of lubrication, then I say something is going on that needs to be addressed. You'll also appreciate not over-oiling a gun on laundry day when you have to get gun oil stains out of your pants and shirts.
Lastly is parts replacement. Semi auto firearms run off of a carefully balanced ballet of forces and counter forces, which relies heavily on springs. With every cycle, these springs wear (though not visible in many cases.) When the spring tension/pressure is appreciably altered, they should be replaced by either a well informed gun owner or a gunsmith. Failure to do so will result in decreased reliability. You revolver guys aren't out of the woods either, it isn't magic that makes that hammer rotate and smack a primer when you pull the trigger. Opinions on how often to change certain springs in certain firearms varies wildly. Suffice to say, if you're shooting and training regularly, your firearm will give you more than sufficient indication it would like some attention at your earliest convenience. Neglecting the warnings will cause it to become more vocal until it refuses to cooperate at all.
Gun maintenance isn't rocket surgery. A little bit of cleaning, which I recommend following EVERY time it is discharged, keeps things running fairly smoothly. I also make a point of cleaning a gun if it's sat unused for 60 days, which gets some fresh oil on to keep corrosion at bay and lets me check for rust or other oxidation. Leaving your gun sitting in a holster in a sock drawer for six months to a year is a sure way to start the process of ruining a firearm. Lubrication isn't an exactly science, but a necessary part of your firearm's care and feeding. Enough to keep things from being gritty, not so much that it's dripping, and there is a fair tolerance between the two that keeps things happy. Above all, do not neglect your firearm to rust away in a closet nor ignore it when it starts to complain. Either behavior will almost guarantee a firearm that is not ready to defend your life if it is called upon. - Phil Rabalais