When computing the gravitation force, how do you know what the direction of the solution?

I assume you have some distributed masses, each with a gravational force. The resultant force will be the addition of each force as VECTORS, and you should add them as such. I hope this is what you mean.