We can understand it intuitively in this way - Traverse the entire tree using any Tree Traversal Algorithm of your choice and keep track of nodes that have no descendants (leaf nodes). A tree traversal algorithm won't take more than $O(n)$ in the worst case, where $n$ is the number of nodes in a tree.
Here is a recursive algorithm for better understanding -
int countLeaves(Node node){
if( node == null )
return 0;
if( node.left == null && node.right == null )
return 1;
else
return countLeaves(node.left) + countLeaves(node.right);
}