International law accepted by the European Union and regulated by EC Regulation N 261/2004 allows airlines to sell more seats than they have on offer. Sometimes this means that some passengers remain on land. It is what is known as overbooking or denied boarding.
In case of overbooking on a flight you have the right to claim.
However, there is a small print. Depending on whether you are considering voluntary or non-voluntary overbooking you will find it easier to get compensation.
Overbooking Volunteer: You can not claim the European compensation but you can claim the refund of the ticket, the alternative transport and the conditions agreed with the airline.
Non-Volunteer overbooking: You can claim the reimbursement of the ticket, the alternative transport, hotel if necessary and the European compensation of the EC regulation N 261/2004.