The beam and detector of the NA62 experiment at CERN