Scientists have a few ways of doing that. First, they can look at the exo planet's atmosphere to see if it has unusual types of gas which could only arise from life. Or if we ever got to go to one we could look for unnatural structures, that won't happen for a long time thogh.