Cognitive Science suffers from the peculiar problem that we are using our cognition to try to understand cognition. Science is about reducing bias and subjectivity through peer review and reproducibility, but the mind is the source of subjectivity, so how in the heck do we study it.
As I see it, there are four broad methods for studying cognition:
This is probably the least reliable because it is the most subjective, but I don't think it should be discounted out of hand for that reason. A researcher might gain insights into their own cognitive functions by reflecting on how they might work and paying close attention to how they think, the ways in which their memory works, etc. Obviously, the main drawback is that an individual has privileged access to this kind of information, so it is not subject to unbiased reproducibility.
2) Verbal Communication
This method basically entails asking people what their states of mind are. If I ask you whether you dream, and you say "yes," this is increased evidence that humans experience dreams. The more specific the information gets, the less reliable it becomes, because it relies on relaying information derived from introspection to another party. Still, it is a necessary inclusion in the toolbox.
3) Observation of Overt Behavior
This is the most popular method of studying cognition, and for a time it was the only one. It involves measuring aspects of the outward behavior of an individual, such as reaction time or accuracy while performing a verbal or mathematical task. For a non-human subject, measurements might be made regarding successes or failures at solving a particular problem, such as pressing a series of buttons to receive food. The main problem with relying solely on this method is that the cognitive system is a black box. We only look at the inputs and outputs, and try to make inferences about how the processing might be going on, which is kind of like trying to figure out how a radio works just by listening to it, and not ever looking inside. Which brings us to the last type of methodology...
4) Observation of Cognitive Mechanisms
In the case of biological organisms, this primarily involves neuroimaging, such as EEG, PET, fMRI, etc. Rather than measuring aspects of overt behavior, we look at the mechanisms underlying the processing of information, and how they are behaving. If a monkey is given a task to discriminate between a cube and a sphere, we can directly measure the activity of the cells in their nervous system, or blood flow to a particular area of their brain, which might give some insights into how the task is processed. If we're studying how an artificial intelligence solves a particular task, we have direct access to the algorithm that accomplished the task, and should be able to determine how it did what it did.
When it comes to studying humans, we have all four methods at our disposable, to greater or lesser degrees. Ethical considerations place limitations on the type of data we can gather using these methodologies. For example, lesioning studies, where part of the brain is surgically removed, with monkeys are quite common. These simply aren't ethical with humans. But we do have cases where people suffer damage to brain areas due to injury or disease, which do let us carry out these kinds of studies in an indirect way.
With non-human subjects, such as non-human animals or AIs, we can only use #3 and #4 (at least until those subjects can communicate sufficiently in a natural language). Sign language taught to chimpanzees and gorillas isn't sufficiently rich to communicate meaningful information about their states of mind, and no current AI is close to being able to communicate in a natural language.
Data from all these sources continues to pile up, and neuroimaging especially has advanced as a technique for measuring the behavior of cognitive machinery, but we're still at a loss for strong theories in which to incorporate all the information.