How could we really know if a software is a malware (virus), for platforms like Windows or Android?
Just by looking at it? It'd be probably difficult. If you go deeper and look at your Task manager in Windows and list of apps in android, and see something that shouldn't be there, probably you might find it. If you dive further and analyze packets of data using, say, Wireshark, chances are high you might find it. Please note that none of this is sure shot way of finding the "malicious" app.
Regarding Android, if you download an app for flashlight, and it requests permissions to access your files, or access to your contacts/messages, or if it's sending huge data to some server, you should look at it with suspicion.'
Again, there's no sure-shot way of finding if you've been infected. Although there are some common signs like unexpected rise in data bills, sluggish performance, uncanny behavior of device, but none of them can guarantee that your device is infected.
If you believe that your device is infected, please have a look at this answer