When we're thinking about cells that get infected with viruses, we have a two of subgroups to consider, often denoted susceptible or permissive. In essence, a cell which a virus is meant to successfully infect must not only possess a receptor to that virus for adhesion, but also the ability to replicate the virus (so it needs the machinery!). So these cells must be susceptible and permissive!
After adhesion you end up with an entry phase, this differs by virus, but you can essentially break it down into endocytosis, membrane fusion, or injection. You can get an idea of injection from something like lambda phage, outlined here. Enveloped viruses can fuse with the host membranes because these envelopes are often derived from ER, golgi network, or another plasma membrane. (Remember, viruses are essentially coding 3 basic sets of genes: for structure, replication and binding. It can't just code for everything it needs, either, so viruses hijack the host cell machinery to replicate.) Naked viruses, those that are just a protein coat and nucleic acid in essence, enter the cell through endocytosis and end up uncoating in a vesicle. And to stress it again, if the cell didn't have a receptor for the virus, it probably didn't get it. Portal of entry does make a difference, but I'm trying to keep it simple for our purposes!
Being said, when we're considering most viruses, membrane fusion and endocytosis aren't really using any energy but the host cell's, right? And then when the virus gets in there, they continue to use the host's resources becauase they really didn't bring a lot of baggage, either!
On the matter of "knowing" what they're doing, viral particles really don't do anything themselves. What I'd argue is that they've evolved methods of becoming particularly good at being viruses, many of which make it seem like they're making conscious choices, but suppose the following: Most of the time, viruses are probably just reproducing in such great numbers that it's just faster to get lucky and produce a strain with a better overall fitness.
Mind you, this whole time your body is attempting to fight off the virus, as in HIV, for example, eukaryotic cells have methods at each stage of attempting to protect themselves,
Source: Cellular Self-Defense: How Cell-Autonomous Immunity Protects Against Pathogens
You also have NK cells and macrophages responding to IFN produced by cells distressed by viruses, and eventually the presentation of viral antigens which result in effector T cells and antibodies unique to the virus in question. Another article here shows some methods by which some inhibitors of HIV infection can be evaded by the virus, as well, and just as likely, you also see that HIV has mechanisms of evading innate/active immunity as well! For example, if your antibodies recognize a viral capsid protein, what do they have to bind to if there's a lipid membrane in the way, as in HIV? What if the receptor composition changes?
In closing, viruses are obligate intracellular parasites. They need you to survive, but their objective is to replicate, so sometimes they do end up killing their host, but they aren't really communicating with each other in a fashion like: "I wonder how those other viruses are doing?" They really don't have a means of responding like that, so the end goal? Just keep moving from host to host and keep replicating, in the most basic sense.