You can compare this to a damp sponge. If the pile is too wet it will compact down and restrict airflow. This slows down the process and causes a foul odor. If your pile becomes too wet, turning it will help dry it out. It is a good idea to reduce the size of the composting materials before you place them in the bin.
Smaller materials have more surface area available for microbes to attack.
This is simply the balance between greens and browns. All living things need these elements to survive and they use roughly 30 parts carbon to each 1 part of nitrogen. If too little nitrogen is present in the pile, not enough heat will generate. If too much nitrogen is present, it is released into the air as ammonia and can cause odor problems. N ratio, just remember this is a factor in the composting process.