For example: we observe an ant carrying food back to its nest. We may speak like the ant has a goal of increasing the amount of food in the nest. We observe a student proofreading an essay. We may speak like the human has a goal of improving the grammar and wording of the essay.
The most explicit definition of "goal" I can give is this: a goal is an outcome that an entity is seeking. If the entity chooses actions that the entity believes will increase the chances or the value of the sought outcome, then the sought outcome is a goal.
To determine what goal the entity is seeking, we may observe first what the organism is doing, and second, how the organism changes its behavior in response to some disruption. If we place an impassable barrier in front of the ant, does the ant change its behavior to return to the nest by a different path? If we introduce spelling errors into the essay the student is proofreading, does the student fix them? Generally, if we suspect a system is seeking a goal, the way to test this suspicion is to put some obstacle in the way of the goal and see if the system can compensate for it and head towards the goal anyway.
The above concept is that of an attractor. If we perturb the system a little bit away from a region, does the system return to the region?
There is an objection that many systems tend towards attractors without being intelligent decision-makers. A pendulum with friction tends towards a stationary vertical position as an attractor. Let's just set this aside for now, and suppose that we are only trying to determine the goals of a system with some minimal intelligence, and not applying the methods to simple systems like pendulums.
There is an objection that the process of testing might take an excessively long time period, especially if the organism has secret long-term goals that they are deliberately hiding. But we are asking about what can be ideally found through observation, rather than with the limits of our current technology. With advanced enough technology we could measure the organism to such precision and detail that we can build a neural model of its brain, so that with a powerful enough computer we can answer all subjunctive questions about what it would do in different scenarios, without having to wait for long time periods. This is still empirical observation because the model was derived from empirical observation, and we'd still be looking for the attractors in the organism's behavior.
Let us consider specifically that we encountered an intelligent alien organism, so we have no prior reference for their behavior and cannot rely on metaphors with humans. The only thing we can do is look at its behavioral attractors.
So, is it generally possible to impute the goals or intentions of an intelligent creature from its behavior and its (subjunctive) reaction to setbacks, thus reducing "intention" or "will" to a matter of empirical observation?