To detect root, apps will try something like attempt to call su. If you're rooted and don't want the app to detect it, you can jail the app and prevent it from being able to detect it.
Note that this is in theory. Almost all apps will implement root/jailbreak detection using the same crappy method, just like almost all of them use the same crappy method to detect if e.g. cert pinning is active. But some will use a very clever method that is not widely known and not well-documented.
While it's true you can theoretically defeat any of these checks, in practice it (like most of reverse engineering) can be made incredible complex and difficult. For example, Facebook/Instagram have (as of the last time I checked) a complex custom system for checking if cert pinning has been bypassed, such that you can't just return-void the checks very easily.
This involves using signed hardware that helps determine if the execution environment is trusted. So, users can still root the device, but Android + Play Services can still determine if features (such as DRM) can be relied on.
It makes sense for Google to develop these features, especially as it wants to move Android to new devices (Cars?), reduce risk for mobile payments, in addition to giving stronger security features to content distributors. This also lets Android devices compete with security features like Apple's secure enclave.
Honestly, if you are going to root your device you must accept you are not using it in the supported way the vendor intends. Therefore, you should not expect all the features of the supported configuration. I think that's a fair trade-off. Rooting your device is awesome!
I was reluctant to unroot an old phone to try Android Pay, but having to do it just to watch some movies a tad too far. For me anyway. https://phunehehe.net/xperia-android/
Being an asshole is also legal, but it's still not OK to be an asshole.