Ferrets and cats often get along, although it does depend on the temperaments of all involved. Cats will often play with ferrets and vice versa, and ferrets usually can hold their own against cats. There are definite exceptions though, so supervise play sessions very closely until your are assured that both your ferret and your cat will be fine (and even then you should be on hand to watch over them). Ferrets can actually be a little tough on cats, especially kittens, so don't let a grown ferret play with a kitten without close supervision.
Whether dogs get along with ferrets is a much more complicated and individual issue, and you must carefully consider a dog's temperament before introducing him or her to a ferret. Many dogs will be fine with ferrets, but remember that some dog breeds (such as some terriers) were bred for the purpose of hunting small game, so might be tempted to chase ferrets by instinct. Large dogs may inadvertently hurt a ferret in play, territorial dogs might snap at a ferret if the ferret gets too close to its toys or food, and any dog might instinctively react to being chased or nipped by a ferret. It is possible for a dog, especially a larger one, to seriously hurt a ferret by accident or just by natural dog behavior, so be cautious. If there is any doubt or any sign of aggression, it is best to never have dogs and ferrets run free together. Make sure to keep ferrets away from your dog's food and toys.
As a general rule, ferrets don't mix well with other kinds of pets, either due to risk to the other pets or risk to the ferret. Remember that ferrets are carnivores, and while your ferret may not consciously think of other small pets (e.g hamsters and other rodents, rabbits, birds, small lizards, snakes) as a meal, quick movements by these small animals may trigger a predator-prey instinct in your ferret. Better safe than sorry, so I would recommend keeping ferrets and pets other than cats and dogs completely separated.
1. Know your pets and their temperaments - if one is hyper or snappy, mixing them with other pets could be a problem.
2. Make introductions gradually. First allow a cat or dog to investigate the ferret while the ferret is in the safety of its cage.
3. If your pets get along through the cage bars, hold your ferret while allowing your cat or dog to investigate (it's a good idea to have someone on hand to hold the dog or cat if necessary).
4. If there are no signs of aggression, put the ferret down and allow him/her to interact with the dog or cat. It might be good to leash your ferret and/or your dog.
5. Supervise very carefully at first -- and even if everything goes well you should always be on hand to keep an eye on things and intervene if necessary.
6. Make sure your ferret has someplace to escape to if necessary (a hiding place only the ferret can get to), especially with dogs.
As a general rule (but not without exceptions) a ferret that grows up with cats or dogs is likely to get along better with them. Similarly, dogs and cats that grow up with ferrets are more likely to accept and play with them. Still, for the safety of all involved, it is a good idea to supervise interactions between ferrets and any other pet.