I am not sure what traditional teaching about this is.
Personally, I like to think that animals have a spirit. I mean I am not sure but I like to think they do because they certainly have a personality. I don't think they come back to us, I think they go on to a better place.
I absolutely believe they do. I've had some odd experiences that would suggest that they are still around from time to time. It makes sense to me that if you believe that we have souls that other sentient creatures do too. Look how close we are genetically to other species - I don't think humans are particularly special, just better equipped to ponder the world around us.
If you haven't come across it before, the Rainbow Bridge poem has some lovely imagery - was going to copy it here but see Mumngran has already linked. Hope it brings some comfort - made me blub reading it again.
We've had many a pet funeral in our family. My husband-the-vicar did a particularly great one for my son's beloved pet Kevin the Cockroach. 'Thank you, Lord, that Kevin was such an interesting creature. He was the loveliest cockroach I've ever known.'