I have heard that many Samsung devices have a flash counter so that the company can know if the device had been rooted, even if the device was unrooted later. Are such flash counters or any similar software default in every Android device ? I have an Asus Zenfone 5. Does it too have similar software like Samsung's flash counter ? Thanks in advance.
It is not built into Android, but is built into the bootloader. Not all Android devices have it.
As said by @GiantTree, the easiest way is to boot into the bootloader and checking the screen output. Asus devices in general, don't have any such counter.
Samsung uses a flash counter or the Knox counter, which is triggered when any changes are made to the stock partitions. Knox is tough to reset, but apps like Triangle Away can reset the flash counter.
Rooting usually does not trigger any flash counter, except in cases where you have to install the SuperUser (su) binary manually by flashing it. A clean unroot will, in most cases, restore the counter if it is triggered.
For more information, please see this link : http://www.kingoapp.com/help/samsung-knox-counter.htm
Although the above link contains material related to the Kingo Root App, it contains well-explained information regarding this topic.