The gas limit only specifies the max amount you're willing to pay. If the transaction gets mined, you only pay for the gas actually consumed. If it's mined, the transaction is technically successful (even if the results aren't what you wanted).
If it's not mined, then nobody did the computation, so nobody gets paid anything.