The hidden layers of the neural network which are in between the input layer and the output layer take in input data and apply a function to churn out data from each node which is then weighed by the next layer.
The way I've seen it explained is for example to predict whether a image is a bus , the nodes learn whether there is a wheel , a tire etc or to predict if a person likes a document, the hidden layer nodes map to whether the topic is sports, history etc.
However the "function" that the hidden layer nodes apply, what exactly are they mapping to i.e what is the dependent variable? Is it the output variable that the model is fed ? For example if I'm trying to predict if the image given is that of a dog or cat , then does the hidden layer map the input data to the output variable(dog or cat) ? How exactly does the hidden layer learn useful features? How do the nodes learn different features rather than the same one?