Bowden cables need two things to work properly: correct routing and cleanliness. Correct routing means gentle bends and optimal outer cable length, so that the inner cable doesn't rub on any sharp edge and doesn't bend more than necessary. By the way: technical norms say if a steel cable is supposed to last forever, diameter of all pulleys it travels over must be at least 72 times larger than diameter of the cable. Factor of 40 is recommended for a decent lifetime. Cables on a bike bend much sharper, which means they inevitably fail someday due to material fatigue, regardless of how you care about them. So be careful and briefly check your brake cables before every ride.
The cleanliness needs no comments: if dust gets into a cable, it starts to drag. Water is dangerous too. It doesn't harm stainless cables, but it can freeze in winter and suddenly you are brakeless. Modern plastic-lined cables theoretically don't need lubrication, but they run considerably smoother with a drop of thin oil. Don't try thick grease, it thickens in the cold and the cables don't return well. It's not a problem to remove a cable and clean it. The hard part is to get it back if its end has been snipped off and is now frayed. There are several ways to solve it:
It is worth mentioning there are two types of outer cables. First one (older) is a tube made of helically wound square wire, with plastic coating inside and outside (plus wire mesh shielding or other accessories). It is more flexible, easy to cut with pliers and theoretically can work even after a complete disintegration of all plastic components. Bad news is it's a tad springy, so if it is very long, brakes may feel "rubbery" and some more sensitive derailleurs may misbehave. The second type of cable is made of longitudinal wires embedded in plastic matrix. Its advantage is almost zero springiness (so brakes feel sharper and shifting is more precise) and that the outer plastic coating doesn't crack in bends. Disadvantages are less flexibility (but that can be an advantage sometimes), more difficult cutting (I recommend grinding it apart, pliers are not good for it) and a theoretical possibility of longitudinal cracking of the plastic matrix, buckling and failure if overloaded. I have only used this second type of cable once (on an 8-speed hub where it was included in the package), for all other purposes I stick with the classic helical cable and have never had any problems with it.
When building a new bike (or overhauling an old one), we decide whether to use full-length cable outer, or to use braze-ons and leave inner cable exposed wherever possible. Every cable stop means extra friction and an opportunity for dirt ingress, but on the other hand, very long cable outer adds friction too, as well as springiness, weight and price. Choose whatever suits you better. I don't have a decisive preference and tend to combine the two approaches based on what works better at a given situation.