this is usually problem-specific, there is no general way of determining it (however, it has to have be admissible). For many geographical navigation tasks, the Euclidean distance is a common example.
There is not a unique solution to find h(n), because it is based on the definition and model of problem. For example, in a shortest path finding problem, direct distances between nodes of graph can be used as h(n) function. You should describe your problem firstly and then decide about definition and representation of its h(n) function.