Heat 1/4 cup of the oil in a large 12-inch nonstick skillet over medium heat. When the oil is hot, add the onions and cook, stirring occasionally. Season with 1/4 teaspoon each of salt, pepper, and sugar. Continue cooking, stirring occasionally, until wilted, golden, and well caramelized, about 45 to 50 minutes. Remove the onions from the pan and set aside. Wipe the skillet clean.
Pour an additional 1/4 cup of oil into the skillet and heat over medium heat. Season the potatoes with 1/2 teaspoon of salt and 1/4 teaspoon of freshly ground black pepper. Add the potatoes to the hot oil and cook, stirring and gently turning, until tender and slightly golden, 15 to 20 minutes. Remove the potatoes from the skillet and wipe the skillet clean.
Heat the remaining 2 tablespoons of oil in the skillet over medium heat. Combine the reserved onions, potatoes, beaten eggs, and ham pieces in a large bowl. Season with the remaining 3/4 teaspoon of salt and 1/4 teaspoon of freshly ground black pepper. Add the entire mixture to the hot oil and cook until the bottom is set and the top is still runny, about 12 minutes. As the bottom of the tortilla is cooking, use a rubber spatula to run around the edge of the eggs, lifting slightly to allow the eggs to run to the bottom and cook.
Place a large plate or serving platter on top of the skillet and invert the tortilla onto the plate. Carefully slide the tortilla back into the skillet so that the browned side is facing upward. Cook until the bottom is golden brown, about 10 to 12 minutes longer. Remove the tortilla from the skillet and serve hot, or cool to room temperature, and serve. To serve, cut tortilla into thin slices and spoon 1 or 2 tablespoons of the Aioli onto the side of the tortilla. Garnish with fresh chopped chives.
Place garlic cloves in a blender or food processor and pulse until finely chopped, stopping to scrape down the sides as needed. Add the salt, egg yolks, and lemon juice and process until well combined.
With the machine running, add the oil in a thin, steady stream until the mixture is thickened. Stir in chives, adjust seasonings as needed and serve with Tortilla Espanola.
Yield: about 1 cup