It all depends on what your goals are, your spending budget, what you have and how you use it at the moment.
As I see it, investing in certain particularly dated systems is not very different from "ending up throwing money out a window", because the cost/benefit ratio always remains rather questionable. Apart from this, without knowing where you are starting from and where you would like to arrive it is still difficult to give good advice.
Starting with an ESXi 5.1 system with several hosts. Hardware is a homebrew system which has served well for a number of years. Far too many.
It hosted several servers for a SOHO system hosting email and file system servers. Much of that need is now gone, having essentially retired that business and myself from "professional life". But, I still stay modestly active, now hosting only two Linux servers.
Intent is to do a "hardware refresh" with some form of newer, not necessarily "server class" hardware that will run newer versions of VMWware. And to allow for testing and experimentation to "keep my hand in".
I have some hardware on hand that may suffice. We shall see if I can install 6.x or 7.0.3 on it. I know the latter complained about unsupported NIC on one system I had successfully installed 6.5u1 on.
One question I have regards the host image files. Can I simply copy the datastore files to a new datastore on later versions of VMware, or are there file structure/format differences that preclude that? If so what can be done to resolve that issue?
I suppose the answer is in the documentation, along with details, but, for now a general answer is hoped for.
Remember that since the versions of the ESXi 6.x product line you can no longer obtain a "free" product key, you can register and obtain it only for the currently supported versions 7/8.
For the rest, a VM is nothing more than a set of files usually placed in a folder whose name usually corresponds to the name of the VM itself so most of the time it is sufficient to copy those folders and their contents from one data store to another, just in general, at least I do that, don't carry snapshots with you consolidate them first and make sure the machine is turned off before copying it, not suspended.
Then I have to be honest, it's been several years since I had to manually copy VMs from one datastore to another or interact with ESXi 5.1 so you'll forgive me if I go from memory.
So, there is a similar plan that was posted on here a while back that may work for you. It is for 5.5 rather than 5.1, but you may want to review it.