Yes, the sensor just simply slips into a hole. This is one of those five minute jobs that can turn into a time consuming and/or expensive nightmare.
If all goes well, you remove one small retaining bolt, pull the sensor out of the knuckle casting, and unclip the wiring connector. I had the wheel off when I was doing the work and but there might be enough room to do it without even taking the wheel off. Might be, but I didn't try. But to answer one of your questions directly... Yes you can install the senor with the hub on the car.
I don't remember for sure if you need to pull the sensor to press the bearings out of the knuckles. I know you could pull the whole knuckle off the car with the sensor still installed, but I don't remember about the bearings. By the time I was pressing bearings, I had one sensor snapped in half and the other one came out easily like it should have.
If the senor comes out as intended, then the hardest part of the job might be getting to the other end of the wiring lead where the connector ends clip together. Probably depends on which corner of the vehicle the work is being done on, but I had to replace the right rear sensor on my 02 AWD and I had to remove some interior paneling just to get to the connector. I did front bearings as well, but it's been so long that I don't remember how the front wiring leads are routed. I didn't break either of the front sensors, so the process was uneventful and therefore unmemorable.
Anyway, the installation is obviously the reverse of removal. Clip the connectors together, insert the sensor into the hole in the knuckle and retain with one small bolt. It should slip right in without a fight, but the same rust that prevented the old one from coming out easy might prevent the new one from going in.