No been around for a while so only just seen this. This is my understanding of how it works.
In the case of JJ everything is locked in apart from Leicester's decision whether to exercise the option.
Where it's an obligation, it is usually conditional and the loaning club has no decision to make if the condition(s) is/are met e.g. a condition could be that if the player makes more than 20 starts for the loaning club the loaning club must buy the player, or it could be that if the loaning club is promoted they must buy the player. This is regardless of whether they actually want to sign the player at that point. That's why we see behaviours like a loan player not being played once they're a match away from triggering the obligation if the club don't want to be contractually obliged to buy.
Where it's an option, there are no conditions, it's purely the decision of the loaning club whether to buy the player at the pre-agreed price or to walk away from the deal. The player signs up to the deal when they sign the loan deal, they have no choice at the end of the loan, they're already committed. Likewise the loaning club have no choice, they signed up to the deal when the loan deal was signed, they agreed to sell to the loaning club for an agreed price (they could of course have conditions that increase the price if for example the loaning the team are promoted).
So, it's not possible for another club to come in and gazump the loaning club nor is it possible for the player to decide they don't like the deal after all. Sadly for JJ, he's stuck with it if Leicester want to buy him. He's probably hoping Leicester buy him and immediately cash in by selling him on for more than they paid because they'll need the money.