Here are some examples:
Many = for countable objects
1. Were there (many, much) people at the party last night?
+ ‘Can I count people, and does it make sense with a number before ‘people’?
+ Were there ‘5’ people at the party last night?
+ It makes sense to say that there were 5 people, so use ‘many’
Much = for objects you can’t count
1. How (many, much) milk do you want?
+ ‘Can I count milk, and does it make sense with a number before ‘milk’?
+ Do you want 2 milk?
+ Putting ‘2’ in front of milk doesn’t make sense, so use ‘much’
2. How (many, much) bottles of milk do you want?
+ ‘Can I count bottles, and does it make sense with a number before ‘bottles’?
+ Do you want 2 bottles of milk?
+ Putting ‘2’ in front of bottles of milk makes sense, so use ‘many’ because you can count bottles.