I often see TV shows, for example on the Food network, which showcase a restaurant. They will have a particular recipe which they make, and specify some of the ingredients but of course not in the exact proportions. What are good techniques for reverse engineering recipes, whether from on TV or at a restaurant? I'm not interested in stealing recipes or competing, just in making fun things at home, and I think this sort of thing would be a fun challenge.
Look at similar recipes on the internet and tweak ingredients to match what you want.
A lot of it is intuition from experience cooking and tasting a variety of dishes. Also, a willingness to experiment is important. You're not going the nail the recipe perfectly the first time.
Knowing the cuisine of a restaurant and typical ingredients and techniques of that cuisine can help. If you don't know much about the cuisine, google example recipes for that cuisine. Keep an eye out for common techniques and flavor combinations. If you're looking for a certain sauce, again look to similar recipes from the same cuisine as the restaurant and swap in herbs, different wine, etc as necessary.
For a specific, well-known dish, look at several recipes for the same dish. You can usually tell which ones have been simplified or had more commonly available ingredients swapped in, and which ones are the original.
For ratios, intuition helps. For stuff like pasta to topping ratios, you can kinda guess based on what you want your finished dish to look like. For spices and the like, look at other recipes from the same cuisine for a starting point and then tweak to taste as you iterate your recipe.
You should also learn how to adjust sauces by adding salt, acid (vinegar, lemon, lime), and possibly sugar. In the Zuni cookbook, Judy Rogers suggests experimenting by tweaking a little bit of the sauce on a spoon to see if your change will work, before adding anything to the pan.
And finally, remember you don't really want to exactly reproduce the recipes in the restaurant. You want to make something similar, but make it your own and make it better. One of the great things about cooking at home is that you get to tweak things to exactly match your tastes and preferences.
I had a dessert with rosemary ice cream at a local restaurant. At the time, there were no rosemary ice cream recipes on the internet. But I found an infused ice cream (basil) in a cookbook and looked at the technique (infuse cream and strain, make custard base with it). I replaced basil with a little rosemary, tasted it after infusing to see if I needed more (it was fine) and then proceeded with the rest of the recipe. (The original was paired with tarte tatin, I paired mine with an apple cake.)
Write down everything you know about the recipe. Then google everything: the chef's name, the name of the dish, of the restaurant, the ingredients. It may be a recipe which is published somewhere. Or a traditional dish from somewhere. Or you may hit upon something which gave that chef the idea of the dish. Combine the results of your research with your know-how and start to experiment.
I also find this difficult to do without having tasted the dish in question.
A combination of observation, experience, and methodical experimentation.
Let's say you're at a restaurant and the spaghetti and meatballs blow you away. How can you replicate that recipe?
One option is to ask the waiter to ask the chef. Often chefs are very flattered by this, and will be keen to share their recipe. But failing that:
Look closely at the food, think as you taste it. You can see ingredients, and those you can't see, you can taste. What meat is it? How has it been cut or minced? Are there pieces of tomato or is it a smooth sauce? What other vegetables are floating around in it? What herbs can you pick out? Does it taste like there's wine in there?
You already know how to cook spaghetti and meatballs. If you don't, you're not ready to reverse engineer a recipe -- follow recipes and gain experience first.
You'll also know from experience how to adjust things about a recipe - how the length of cooking affects the texture of meat, how reducing makes the sauce more intense, and so on. So start with the recipe you know, think about what's different between that and the dish you're trying to achieve, and make those adjustments.
You can get a long way just by muddling through, but if you want to get serious, you've got to start measuring and comparing.
The "sane" option for normal cooks who are paying for ingredients and don't want to throw away food, is to weigh, measure and time everything, keep notes on how the food turns out and what to try adjusting next time, and repeat next time you cook the dish. The big issue here is that you're likely to be comparing iterations from memory. "Is this lasagne better than the one I cooked three weeks ago? I can't be sure."
The "fanatic" option for professionals and very keen amateurs, is to run formal experiments. You want to know what the perfect cooking time is for your sauce - so make five batches, cook each one for a different, measured length of time, then taste them all and decide which is best.
Of course, there are dozens of variables in even a simple recipe, so formally testing each one would take huge amounts of effort. This is what research kitchens do, however.
The more experience you have, the less experimenting you need to do -- if I know from experience how long it takes a sauce to thicken, I don't have to experiment.