How does Hawking Radiation work exactly? I know that a particle and anti particle, virtual particles, spawn at the edge of an event horizon, and one particle falls into the black hole, and the other goes out, but how does the other know how to take energy from the black hole? I mean how does it? Does it just know to take energy from the black hole or does the antiparticle fall in, and the blackhole loses mass?
... but how does the other know how to take energy from the black hole?

In order to understand this, you need to be familiar with the essence of this picture$^1$ including negative energy states inside the horizon, creation of virtual particle-antiparticle pairs, and conservation of energy.$^2$ I try to intuitively answer your question with simple words.
Assume that a virtual particle-antiparticle pair is created near the black hole's horizon. According to the principle of conservation of energy, the total energy of the pair particles must be zero. So, one of the particle has positive energy and the other one has negative energy. On the other hand, it can be shown that there exist negative-energy states inside the horizon of a static black hole and the negative-energy particles can occupy these states. In order to have a pair of real particles with zero total energy, the only physical possibility is that the positive-energy particle can escape to infinity, while the negative-energy particle falls into the black hole. In this way, the strong gravitational field of the black hole can convert a virtual particle–antiparticle pair into a pair of real particles with zero total energy. This is the reason why the virtual particle that's sucked in always get negative energy.

Does it just know to take energy from the black hole or does the antiparticle fall in, and the blackhole loses mass?

Note that, in this picture, when a virtual particle-antiparticle pair is created near the black hole's horizon, each of them may fall into the horizon or may escape to infinity (Always, one of them falls in and the other escapes.) So, it is not correct that only the antiparticle falls into the black hole. This means that a static observer outside the event horizon will observe both the particle and antiparticle spectrums.

In my opinion, you should not take the above argument about virtual particle-anti particle pair etc. too seriously since this picture helps to naively have an intuitive understanding. A rigorous treatment of Hawking radiation using quantization of quantum fields in curved black hole background does not need such a naïve picture.


$^1$There exist more rigorous treatments for understanding the Hawking radiation but I restrict myself to this framework (picture) that you are interested in and ask about.


$^2$ Here, for simplicity, I restrict this discussion to the case of static black holes. The general conclusion is still valid for the rotating black holes.