OK. So you're at the fruit machine. The flashing lights are there, this time, definitely, you're going to win... The board gives you a hint, you'll get to the board next time, it's going to be big, the jackpot is there. You get on the board, go round it twice, before it's the dreaded question mark, Game over. Obviously you should have collected, taken the feature. or settled with box 1 (on deal or no deal).

Take a step back, the machine has already decided, before you've even walked up to it, your fate.

Why is it that it sometimes pays out the jackpot in one spin, or will gobble a tenner for nothing in return?

It isn't you playing the machine, the machine is playing you. Offer 4 quid to entice, almost get you on the board, go low on a high low even though you were on number 2 and number 1 comes in. Grr. But people blame themselves, if only I'd pressed a different button...
No. it's not your fault, as i said the machine had this planned from the start, give a little bit, take in more.

Roulette wheels:
That green zero where house always wins ..
Even if the machines aren't rigged, playing red or black 19 times and chances are the house will take it all, that's a percentage to the house of 5% on each spin.
But i was so close, only one number away ....
This applies to the lottery too. You don't get any prizes for being next to a number, and chances are you always will be. It's binary, you win or you lose, mostly often the latter. You "could" win big, but the odds are so remote you're more likely to be struck by lightning.

That one win ...
My problems with fruit machines started in Brighton, I won £62 quid, and spent at least half of my student overdraft on the things. There's a quote from Douglas Coupland in Generation X, we live in the past because we forget all the bad bits, and look to the future because it hasn't yet hurt us. The same applies with gambling. We forget how much we've lost because this time this time we'll win.
Weherspoons make 4 million pounds a week from their fruit machines, it says on the front 78% payout, house always wins. Ladbrokes / Coral profits for 2018.