According to a CDC-funded study, nearly half of adults will develop osteoarthritis in at least one knee by the time they're 85, but that number doesn't actually need to be so high. Here's an explanation of where most knee pain comes from and an easy solution for relieving it.
Unless there is a structural issue in the knee itself such as a meniscus or ACL tear, most knee pain comes from a lack of healthy leg alignment. Knees are picky things with a very complicated structure, and they like to be oriented directly up, down, and centered. That structure can take a huge variety of stresses without being injured, but over time those stresses build up and can lead to many painful conditions, such as arthritis. The easiest way to take care of your knees is to give them the best possible chance of avoiding that stress build up.
As you can see in the picture, there are three basic types of knee alignment. You can easily find out which alignment you live in - everyone tends towards one of these three options. Stand in front of a full-length mirror, put your feet in parallel, and look at where your knees point.
If your knees point in or towards one another, you likely walk pronated, with weight more weight on your arches and big toe, and less weight on the outside of your foot. In this alignment, pressure is sent through the outsides of your knees.
If your knees point away from one another, you likely walk supinated, with more weight on the outside of your foot, with high arches. In this alignment, pressure is sent through the insides of your knees.
Knees are happiest facing forward, where pressure can fall straight through the center. Here, the muscles around your knee get to work evenly, the ligaments supporting the sides of your knee stay neutral, and the ends of the two large bones in your leg (femur in your thigh and tibia in your lower leg) match up like pieces of a puzzle and roll over each other easily as you bend and unbend your knee.
What You Can Do
Anytime you're putting pressure through your foot, try paying attention to where your knee is pointing. Whether you're walking, running, climbing stairs, doing yoga, or riding a bike, the healthiest place for your knee to point is over your second toe.
Here's an experiment to feel what each alignment is like. Sit down in a chair and place your feet on the floor parallel to one another. Keeping your feet in parallel, point your knees towards each other and stand up. Sit again, keep your feel in parallel, point your knees away from each other, and stand up. Once more, sit down keep your feet in parallel, point your knees forward, and stand up.
With each alignment, notice what you feel. Is one alignment easier or harder than another for you? How do your knees feel in each? How does your balance change between them? These are all clues you can use later to find out which alignment you're in and if you're knees are happy.