If you have ever formatted a compact flash card that had photos on it you still needed, the first thing to do is make sure you don't mess with the card at all. Then, check out PhotoRec. An open source tool that tries to recover photos that have been deleted. It's a bit cryptic to use, but there is a step-by-step procedure in the documentation that'll walk you thru it. I've used it once with success to help get photos off a friends card.
If things get corrupted, there is also TestDisk, which is bundled with PhotoRec. I haven't used it, but it's worth a shot if you run into real issues with a card.
Other than being Free Open Source Software, these apps have the added bonus of being available on multiple operating systems including Mac and Windows.