How related products work depends on which theme you're using, but typically it'll load the other products that are in the same collection as the product you are currently viewing.
If you're looking to handpick your related products, or have them work another way, have a look at this wiki article: http://wiki.shopify.com/Related_Products
I'm working with the 'New Standard' theme, but couldn't find anything in the related product snippet that gave me any clue as to how it was deciding what to pick - just that it was using the 'collection.products' variable. The description of that on Shopify's wiki is a bit vague:
'Returns a collection of all products that are associated with this collection which match the current view. This takes into account things like paginate and selected tags. '
I have what are essentially two sets of collections - X1, X2, X3, etc and blue, green, red, etc. I want to limit related products to the X1, X2, X3 collections and exclude the color collections, but it always picks related products from the color collections. I'm a total newbie with liquid, but from what I've picked up so far, I feel like there must be a way to restrict related products to specific collections?
I had already checked out that link, but couldn't find an answer :(