I think the overall meaning is pretty much the same, but there is a slight difference in tone: lots of has a more informal tone that might work well on a playground or in a valentine, but much might be a good substitute for a campaign speech or technical paper.
We had lots of trouble getting the experiment to work.
We had much trouble getting the experiment to work.
I think the bottom version would sound better in a technical paper. However, sometimes you can make the noun countable, and use many instead of much. For example:
We encountered many problems getting the experiment to work.
It also depends on the context. Sometimes you can't simply substitute one for the other. For example:
Add lots of chili powder if you like it spicy.
Add much chili powder if you like it spicy.
In that example, I prefer the top sentence (the "lots of" version). However, if we switch to the negative, things might change:
Don't add lots of chili powder unless you like it spicy.
Don't add too much chili powder unless you like it spicy.
In that example, I prefer the bottom sentence, with a too added before much.
As for picking the best wording, I'm not sure if there's a general guideline that can be followed. There are many complicating factors, so this is is one of those areas where you need to rely on intuition, style, context, and experience.