The correct method is to calculate the expected value for each hand. Everyone seems to take as a starting point for this calculation that, with a 52-card deck, there are 2,598,960 possible five-card poker hands, "because the order of the cards is not important in poker". This is true, but suit is not important either, in the sense that, for example, an A-J-9-5-4 of hearts is exactly equivalent to an A-J-9-5-4 of spaces. Taking the suit equivalences into account, a 52-card deck yields "only" 134,459 unique poker hands. There are 32 possible discards for these hands, from "stand pat" to "draw five". The only completely correct methodology is to calculate the expected value of each discard for each hand, 32*134,459 calculations.
Back in 1985 on my old IBM PC-1, these calculations used to take more than two weeks. Three PC upgrades later, I can knock off the calculations for a new payout table in less than two days. Once complete, I know exactly the correct discard for every hand, and I know exactly the net return for the machine when played optimally.
However, the problem is that there are now 134,459 rules for how to play the machine, one for each possible initial deal. This has to be reduced to a manageable number, like 40 or 50. This is art, not science -- trying to find a small number of rules that capture all, or almost all, of the cases. I have a program that evaluates a proposed set of rules. It lists the hands the rules miss, and the net return lost due to the misses. I keep iterating on the rules until I get a set that is correct for all the hands, or, at the very least, has a net imperfection of less than 0.01%.
It appears that the approach most commonly used by others is different: to calculate the (average) expected value of each type of hand, then rank all the types of hands by this expected value. This ranking then becomes the strategy, and, using the occurance of each type of hand in the initial deal, the net return can be easily calculated. The flaw with this approach--and it is a small one, to be sure--is that prematurely placing the hands in buckets based on type can miss some interactions.
For example, in jacks-or-better, take the case of the an ace-king-queen-jack hand, where the queen and jack are of the same suit. Which is better, to go for the two-card queen-jack royal, or the ace-king-queen-jack inside straight? The queen-jack royal has the higher expected value, so we should draw to that, right? The true answer is that you have to tell me what the fifth card is. If it is a nine, or it is of the same suit as the queen-jack, then the ace-king-queen-jack is the better play (assuming there are no straight flush possibilities, of course). The expected values of the two hands reverse because the nine would hurt the queen-jack's straight possiblities, and the card of the same suit would hurt the queen-jack's flush possibilities. It is subtleties like this that can be missed by placing the hands in buckets first.