i would like to know what institution gives permission to issue derivatives such as future and option to exchanges.
what laws and regulation are related to them ?
That would depend on where they operated. In US, you can learn about CME futures to see an example of how it gets approved by the government.
second i would like to know how exchanges like bitmex, deribit etc provide funding and liquidity .
like for instance a guy with 100 dollar can trade dollar 5000 with 50X leverage if the price goes up 5% he earns 250% that means 250$ .
now the question i am asking is how to exchanges pay that $500.
if you will say that other people buy the first guy order then i am gonna say next guy who bought the same stock with 100X leverage and capital $50
now the contract is settled with the first who earned $250+$100 capital. and the order is fullfilled by a $50 margin trade by another person. So how does the exchange pay that $250 ?
AFAIK, they have something called a liquidity pool. They'll use this to pay for those who use margin trading. If the exchange is professional, they won't give a trader an opportunity to trade more than they can afford. Let's say your pool would only suffice to support or pay 10x leverage for 1 million users. Allowing them to trade more than 10x leverage would be risky. Sure, they might 'earn' from those who're losing their contract, but it is possible that it won't be enough so they'll need to get more funds.