Why do some cheeses melt smoothly and others do not?
Melting behaviour depends on three things: moisture, fat and how tightly the cheese's protein network is bound. Cheeses that melt into a smooth flow have enough moisture and fat, and a protein structure loose enough to release.
Cheese is a matrix of casein proteins holding fat and water. Heat weakens the bonds between casein molecules, letting the structure relax and the fat flow. Young, moist, higher-fat cheeses — mozzarella, gruyère, cheddar, fontina, raclette — do this readily.
Two things prevent it.
Acidity. Cheeses made by acid coagulation rather than rennet have a protein structure that tightens rather than loosens with heat. Paneer, halloumi, ricotta and queso fresco are made this way, which is exactly why you can fry or grill them and they hold their shape. That is a feature, not a failure.
Age and moisture loss. Very aged cheeses like well-matured parmesan have lost so much water and formed such a dense protein network that they do not flow. They will soften and can be melted into a sauce with liquid, but they will not stretch.
The common failure with good melting cheese is splitting — the sauce turning grainy with oil separating out. That happens when it is heated too fast or too hot, breaking the emulsion. The fixes are gentle heat, adding the cheese off the heat, and including a starch or an emulsifying salt. This is why a cheese sauce is built on a flour-thickened base, and why processed cheese slices melt so uniformly: they contain added emulsifying salts.
A splash of acid such as white wine also helps keep a fondue emulsified.