Crema in an espresso shot comes from CO2 escaping from the coffee grounds during extraction. The fresher the coffee is after the roast date, the more crema you will get because that is when the beans have the most crema. Once beans are roasted, they slowly lose CO2, and after an extended amount of time there will be little to no CO2 left in the beans. Therefore, if you want to have a lot of crema in your espresso shots, you will need to use beans that are less than 2 or 3 weeks old.
Assuming your beans are fresh and still have CO2, you will get more crema in the cup if your grind size is dialed in correctly. If your grind size is too large, water will flow through the grounds without actually extracting the grounds and you’ll get little to no crema.