How do people at service center check if the phone is rooted or not? How do they check it, in order to decide whether the phone is in warranty or not?
I am referring to the majority of the phone manufacturers who void the warranty of their phones 'as soon as they are rooted'.
Varies as per OEM


Most devices need bootloader to be unlocked before rooting. OEMs like Motorola insist on a formal request to be made on their website for obtaining boot loader unlock code. The moment you make the request, your warranty is void whether you unlocked the bootloader /  rooted or not


Edit: Since you own a Motorola device, more details


When you request for bootloader unlock code, you have to identify your device serial number, which means database is available with service center to check against your serial number. Motorola clearly warns you that requesting for unlock code  = rooting, whether you root or not and void warranty


If you do unlock bootloader and do not take steps to prevent this warning from showing up (involves flashing a custom boot logo file) , this image will show up everytime you boot. 






Even if you lock bootloader again by applying a bootloader lock code, in bootloader mode it will show 

`DEVICE IS LOCKED. STATUS CODE : 2' 


whereas the status code for unlocked devices is 1

So be very sure about unlocking bootloader, the service center guys can easily find out !!


For Samsung devices it is very easy to read the Knox status. If that is tripped, your warranty is void ( exceptions apply in some geographies)
Some devices display Modified / Custom status in the device properties or in diagnostics ( this to Andy for pointing that out)
It is reasonable to expect that OEMs who void warranty on rooting would have a root status shown in the device diagnostics. Just in case there isn't, they can  use Root Checker apps, or check using Terminal Emulator. Use of third party apps I guess would be more of an exception, since inbuilt tools would do the job