In general, the longer the warranty, the better the quality of carpet. We have thirty year old off white carpet that almost looks like new. Buy high quality with a long warranty and vacuum frequently.
If you want it to last, don’t wear shoes while walking on the carpet. If you want to wear shoes, look at what hotels use. They opt for a low pile, patterned and sculpted surface that helps hide the wear pattern and staining. Choose a low pile that does not show marks from a vacuum. Choose a quality fiber and invest in a good quality pad. Stop by carpet stores near you to see what they recommend then ask about sales current, prior and future sales. A good sale can lower the price by a lot and make a quality carpet cost the same as a crappy one.