Fifty years after homosexuality was decriminalised, the Tate’s Queer British Art show explores a history of refuge and rebellion