There are 2 ways of upgrading. What device you have will determine whether either is available to you.
Official updates are provided by the manufacturer. If you bought a device that was originally locked to a service provider it's likely they modify the software, in which case they have to distribute updates. You download these over the air ("check for updates" in your settings, usually under "system" or "about"). If there isn't one available that probably means the manufacturer hasn't produced one for that phone. If you are still on 5.1 I expect this is the case.
The second way is via a "custom ROM". Software always has been built for the specific model, but for some models people will have built their own versions which you can download and install. For popular devices these may include later android releases than were officially provided for that device. To do this you first need to find out whether what you want exists for your device. If it does then you need to find a custom recovery for your device (must be for your exact model), unlock the bootloader, install the recovery and use that to install the ROM. As this is all device-specific nobody can help you without knowing exactly what phone you have. But you really should check whether a suitable ROM exists before worrying about the rest - for many models it will not.
If there is no official update and no suitable custom ROM that is it, unless you can learn to build your own ROM. There is no generic android update that can be installed on different devices (a statement that is true for other mobile platforms too).