You should vacuum your carpets at least twice a week! All of the dirt and dust you see in the picture was pulled out of a 3 bedroom medium size house. Imagine your kids laying on your floors watching TV, or just running, and rolling around in all of that dirt. carpets act as an air filter, and might be hiding a lot of pet hair, dust, and tracked in soil. It is important to remove these pollutants from your environment with frequent vacuuming.
How to do it correctly though? Vacuum often, going over traffic areas more than once. Invest in a good vacuum cleaner with a rotating brush that scrubs the carpet and loosens up soil from the fibers. Empty your vacuum bag or cup when it gets half full. You can also add some baking soda to the bag in your vacuum to fight unpleasant odors.