This question already has an answer here:
This is a hypothetical question that came up in discussion.
Consider a situation where I am in country A. I take a flight to country B, and am refused admission at the border. However I am not allowed back to country A -- maybe I only had a single entry visa, or I used up my visa-free allowance; either way I can't be just put on the next flight back from the same airline.
In this case, how would the removal work? Would they send me back to my home country? Would they force the airline to take me somewhere directly that I am allowed to enter? (And if the airline I came on doesn't fly anywhere from B to where I can go, will the airline need to pay for a ticket on a other airline to somewhere I can enter?)
For a concrete example: a US citizen flies from Spain to the UK after using up his/her 90-out-of-180 days in the Schengen zone. The immigration officers in London refuse entrance for whatever reason. What happens to our poor Yankee friend?