The answers so far are not entirely correct. The warranty does not expire in every case. If you are still able to load the stock ROM after a defect, it will be repaired by the manufacturer under warranty (of course, only if other warranty conditions are met). I had such a case when the DA module for the sound failed. This was repaired under warranty without any problems. At that time, I was still able to flash back from Cyanogen to stock.
Of course, it must not be a defect that was demonstrably caused by an app that uses root. Then, understandably, it will not be repaired under warranty. However, this happens very rarely.