You need to choose carefully, since many vendors and carriers will abandon devices quickly as they release new ones. So no, you cannot guarantee that ANY device running 5.0 will be able to upgrade to 6.0. However, here are some suggestions to improve your chances:
- Get a recent Google Nexus device. These are always the first to get new releases because they are Google's Android showcase devices. Check this page for devices that have 6.0 firmware available.
- Get a device that is on this list. CynaogenMod (CM) is a very good alternative firmware that has breathed life into many, many old
devices that have been long-forgotten by the vendors. CM13 is the
version based on Android 6.0 and they are working hard to expand the
number of devices supported.
- Take a look at XDA-Developers device
forums and look for devices that have unofficial Marshmallow
builds. Keep in mind that many of the ROMs posted there are
experimental and possible unstable, and this may be especially true of a new 6.0-based ROM.
- Get a device that has an upgrade guarantee or a device that the manufacturer has stated will be getting 6.0. This article is a nice recent list that will get you started, and there is also a Community Wiki on this site tracking status. However, keep in mind that even if you have a device from this list, the carrier may take longer to (or never) push out the update. As an example, I once had a phone where HTC had released an update but my carrier took almost a year to push their branded version to my phone. If you can't root your device, you may be at the whim of your carrier.