Here are two books which describe algorithms used for implementing computer algebra systems:
Computer Algebra and Symbolic Computation: Elementary Algorithms
Computer Algebra and Symbolic Computation: Mathematical Methods
I used these books to implement libraries for computer algebra in Scheme (MPL) and C# (Symbolism).