In a binary search question how do we identify when the answer will be at lower bound, when at upper

I just started learning Binary search
I have understood that when we are finding some exact element we return mid

but in some more advanced questions we have to return lower bounds and upper bounds, how do i identify that? when to return what, I am getting super confused.
kindly help

Just when you get your key matched with your mid value then you just have to print the variable start & End . Start will the lower bound of the array and the End variable is the upper bound of the array .