Can spacecraft be made invisible to ground stations? For example, are spy satellites perhaps equipped with stealth technology to prevent radar tracking? Or is it pointless as they can always be optically tracked?
Not particularly, at least not long term.
Let's take a hypothetical high earth orbit imaging satellite. We want it stealthy. Here are the iterations....
We have to account for the blackbody radiation, which is the infrared light given off by all objects that are above 0 kelvins (-273.15° C). To hide this, we need to exactly match the backdrop. That backdrop is either 2.7 K (cosmic background), or anywhere between 20 K and 310 K (the moon), or 5778 K (the sun). Cooling anything to under 20 K is difficult even in the lab. It's impractical long term, and nearly impossible when the sun is trying to keep it around 250 K. Plus, every electronic device and the power source produces heat. (And it won't be using solar, because Solar is VERY visible.)
We can get it down to "barely noticeable" by cooling it to about 50 K on one side, but the other side is then going to be considerably warmer. Anything flying behind it will reflect some of this increased IR (and also heat up). Further, if it winds up between a further object that wasn't designed for, it may occlude the object, which blips off the view briefly.
We also need to block visual - it needs to look like whatever is behind it. Black objects aren't going to stay cool, so we need to put it against the moon or sun. And moon, that's still gray, so it's going to need more cooling.
Then we need to make it invisible to radar - stealth tech doesn't actually make it invisible, just reduces the return to lower than some threshold. Since the USAF tracked (until 2013) objects down to the size of a few square centimeters, any useful sized satellite will still be big enough to exceed the squelch setting on the orbital radars. Further, if radar absorbing materials are used, they add to the heat that needs to be eliminated.
Finally, we need to cope with the optics - they are reflective by their very nature. So, again, we have a problem. If the optics are aimed at earth, the optics can be detected from earth.
As you can see, any one is doable, but blocking all of these is hard.
And we still have not gotten to a useful satellite; there's no data return. An antenna is, itself, a reflective item, and the focusing dish is by design a highly reflective surface in its operational wavelengths. Plus, when transmitting, the signal itself is a beacon. Too many private dishes and university dishes looking for off-earth signals. Someone gets a "wow", it gets confirmed, and the object is detected. Then, others start looking at what's there.
Also, several of these are directional - viewers from various ground stations may be looking at it side on. Which, from even just two places in the US, means it's not going to be up against the moon, but against the cosmic background.
Far easier is obfuscation - put the military mission on a non-military satellite. Release the wrong image detail specifications. But you still have the issue of secrecy.
So, in the long run, no, you can't make a satelite invisible to a down-station and still observe earth.
The key is that you don't need to make a satellite impossible to see (e.g. cooling it down to 20 Kelvin); You just need to make it harder to see.
"Misty" is supposedly the codename of a stealth satellite project run by the National Reconnaissance Office (NRO). There are at least two suspected Misty satellites in orbit (See the "Misty" article on Wikipedia for more).
The Misty design supposedly uses a conical reflective balloon, patented as a "satellite signature suppression shield" by Teledyne, who did the design for the NRO, in patent # US5345238 A. The balloon is designed to "suppress laser, radar, visible and infrared signatures of satellites to make it difficult or impossible for hostile enemy forces to damage or destroy satellites in orbit." Basically, when the cone is pointed in the general direction of a laser sensor or radar, the laser beams and radar waves are reflected away from the Earth. Optical tracking is suppressed because (according to the patent) most visible light reflecting off a satellite comes from the Earth, and that light is reflected by the cone into space instead of back toward the Earth. The balloon reflects most energy from the sun, so its infrared signature is lowered by two orders of magnitude.
The cone must be pointed in the general direction of the sensor you want to hide the satellite from in order to be effective, and the following charts show how the degree of stealth changes as the cone's aspect angle changes. Fig. 3B from the patent shows how the radar cross section (RCS) is about 15-30 dB smaller than that of a typical satellite at an aspect angle of 0.
This means that it's important to aim the cone at the sensor you want to hide from. Some amateur observers even think that their locations are programmed into Misty satellites as "hostile", so that the satellite will do its best to hide itself from them when it's overhead.