Foam is a layer on top of the cocktail, as compared to bubbles, which are dissolved in the liquid. Foam adds texture and visual appeal to cocktails.
Foam is akin to umami. Based on the growing popularity of molecular gastronomy, and now that umami is considered a basic taste(!), there is growing use in foam in cocktails.
While nobody argues that bubbles are good, foam is a different story. Some people think foam, specially artifically induced, is a gimmick, and does not add any value to cocktails, and that the only foam should be from egg whites, carbonation or shaking hard.
Check out this article on foam: https://www.seriouseats.com/cocktail-science-foam-eggwhite-gomme-dry-shake-beer-foam-eggwhite-alternatives
There are a few different ways to create foam in cocktails:
Egg whites: One of the most common ways to create foam in cocktails is by using egg whites. The proteins in the egg whites will denature when shaken and form a stable foam. To use egg whites in a cocktail, shake the egg whites with the other ingredients until they are fully combined and a foam has formed on top. Egg whites are fundamental to cocktails like the Whiskey Sour or Pisco Sour. Unfortunately, the use of egg whites in cocktails is now feared because of concerns about Salmonela.
Cream or milk: Cream or milk can also be used to create a foam in cocktails. The fat in the cream or milk will help to stabilize the foam. To use cream or milk in a cocktail, shake the cream or milk with the other ingredients until a foam has formed on top.
Aquafaba: Aquafaba is the liquid that is found in a can of chickpeas. It can be used as a vegan alternative to egg whites to create foam in cocktails. To use aquafaba in a cocktail, shake the aquafaba with the other ingredients until a foam has formed on top.
Nitrous oxide: Nitrous oxide, also known as laughing gas, can be used to create a stable foam in cocktails. To use nitrous oxide in a cocktail, the ingredients are placed in a whipped cream dispenser and the nitrous oxide is added. The dispenser is then shaken to create the foam. Nitrous oxide is a powerful oxidizing agent and can be dangerous if used improperly, so it is important to follow the instructions carefully when using it.
Gelatin: Gelatin can also be used to create a stable foam in cocktails. To use gelatin in a cocktail, the gelatin is dissolved in a small amount of hot water and then chilled until it becomes solid. The solid gelatin is then broken into small pieces and added to the cocktail ingredients. The cocktail is then shaken to create the foam.
Xanthan: Xanthan is a thickening agent that can be used to create a stable foam in cocktails. To use xanthan in a cocktail, the xanthan is dissolved in a small amount of hot water and then chilled until it becomes solid. The solid xanthan is then broken into small pieces and added to the cocktail ingredients. The cocktail is then shaken to create the foam.