Preheat your oven to 375°F (190°C). Lightly grease a 9x9 inch casserole dish or similar oven safe dish. Set aside.
In a blender or food processor, puree the corn kernels with the milk until smooth but slightly textured. Transfer to a saucepan and heat over medium heat. Add the butter, sugar (if using), and salt. Stir frequently for about 10 minutes, or until the mixture thickens slightly. Remove from heat and set aside.
Heat the olive oil in a skillet over medium heat. Sauté the onions until translucent, about 3–4 minutes. Add the garlic and cook for another minute. Stir in the ground beef, breaking it up with a wooden spoon. Cook until browned.
Add the paprika, cumin, chili powder (if using), and salt and pepper. Pour in the beef stock or water. Reduce the heat to low and simmer for 10 minutes, allowing the flavours to meld. Adjust seasoning if needed.
Spread the beef mixture evenly at the bottom of the prepared casserole dish. Layer the shredded chicken on top (if using), followed by the olives, hardboiled egg slices, and raisins. These additions are traditional and add depth of flavour.
Spoon the corn mixture over the filling, spreading it evenly to cover the entire surface. Use the back of a spoon to smooth the top.
For a traditional touch, lightly sprinkle sugar over the corn topping. This will create a caramelized crust during baking.
Place the casserole dish in the preheated oven and bake for 30–35 minutes, or until the top is golden and bubbling slightly around the edges.
Remove from the oven and let the casserole rest for 5–10 minutes before serving. Spoon generous portions onto plates and serve with a simple green salad or crusty bread. The interplay of the sweet corn topping with the savoury beef filling makes this dish a beloved staple of Chilean cuisine.