The obvious answer: keep playing until you win. Keep in mind that there is a good chance that the amount you win will usually be less than the total amount that you lost up to that point, but if everybody won, then the casinos wouldn't bother having the machines in the first place.
Seriously, my advice: play dollar machines - except Megabucks. The more money it costs to play a machine, the "looser" the machine can be and still make enough money for the casino to keep the machine there. Megabucks is the exception, since enough people are drawn to it by the promise of a huge jackpot that the machines can be tighter and few people are going to notice, or care.
Second: don't listen to people who tell you things like, "Play the machines that you can see from the entrances - they are looser so that people walking by the casino will see a lot of winners and come in to play," or, "A particular machine is 'due' to hit at any time." The best example of a machine that was "due" for years was one called Lion's Share
at MGM Grand.