The successor of an element in a BST is the element's successor in the sorted order determined by the inorder traversal. Finding the successor when each node has a pointer to its parent node is presented in CLRS's algorithm textbook. (Intro to algorithm by MIT press). Now I am thinking another question, can we find the successor without using the pointer to the parent node. Sometimes our tree node does not have this pointer. I struggled a couple of hours but cannot write the correct code.
The idea in CLRS's book of finding the successor is, if the right subtree of node x is nonempty, the successor of x is the min element in the right subtree. Otherwise, the successor is the lowest ancestor of x whose left child is also an ancestor of x.( Note a node is an ancestor of itself).