We suggest preparing them several weeks ahead (if you have that much time) that he or she could pass on sometime while they are at school or that their friend is slowing down, is very uncomfortable, and may not be with you for much longer. Encourage them to spend extra quality time during the last few days to weeks. Having them come home from school to find their buddy gone can be very traumatic.
If your kids are old enough to understand the process, allowing them to be present can help them grieve and cope with the loss.