So, if you can, learn how to play solid basic strategy for each game that interests you. Or, specialize in one particular game and master that one.
If, on the other hand, you are not interested in memorizing charts and you are relying on luck to bring you riches, then it's best to follow some general guidelines and cash out when you are ahead of the game.
Here's a good rule-of-thumb strategy based on the cards that are first dealt to you on a machine that gives your money back for a high pair (a pair of jacks, queens, kings, or aces). The suggestions are based on the fact that you aren't dealt any possible higher paying hands. (For example you're in a no-pair hand you might have four to a Flush, in which case you'd keep the four to a Flush and draw one card.)
1 No pair: Throw them all away and pray for a better hand. 2 Pair: keep the pair and draw three cards. Don't keep any other card. In some cases, people think that since a machine pays off for jacks or better, they should keep a jack or higher with their pair. This doesn't increase your chances of winning. In fact, it decreases them significantly. 3 High Pair: Keep any pair unless you have three or four cards to a royal Flush, Straight Flush or any of the top three paying hands listed on your machine. 4 Two Pair: Hold the two pair and draw one card. 5 Hold any pat hand that doesn't have four cards to a higher payoff hand. For example, if you have a Straight but four of the cards are of the same suit, you would throw away the fifth card and hope to complete the Straight Flush. 6 Don't draw to inside Straights. That is, if you have 4, 5, 7, 8, K, don't throw away the king and go for the Straight. If you do, you're hoping for just one particular card (the six) and there are only four of them in the deck. If you keep the King, you could get anything from nothing to a pair of kings and up-including the royal Flush! 7 Draw to an open-ended Straight. Open-ended means that you have four cards in sequence. You might have 4, 5, 6, 7, for example, in which case a 3 or an 8 will give you a Straight. This makes eight cards working in your favor. Beware, however that this doesn't work for a Straight that starts with an ace. A, 2, 3, 4 X is not open ended. There's nothing that can fit in front of the ace to make the Straight. 8 Keep three of a Kind and draw two cards. 9 Keep any kind of four-card draw that leads to a high payback (Straight Flush, royal Flush, five of a Kind). 10 Keep all Flushes and Straights unless the Flush can turn into a royal Flush. 11 Always hold a full house, five of a Kind, four of a Kind, a Straight Flush and a royal Flush.
Remember, this is not perfect strategy; it is a general strategy that will help stretch your gambling dollar.