i make random moves then hope for the best
What should i do if there are no good moves?

if its the endgame, and there are no good moves, ur lost. If its the middlegame, just maneuver ur pieces to better positions

I think it all depends...
on what type of endgame it is, what pieces you have, and whether you have a plan or not.

Well if there’s any position with no ‘good’ moves, then you’re losing. A good move can be considered any move that isn’t losing, so yeah. But if you’re in the endgame, and you can’t find any good moves, either play some zugswang, or evaluate the position, because it could also be a drawn one.

There also could be moves you aren't seeing, or a way to get to a position where you can make better moves

Take your worst piece and try to improve its position. That's according to Boris Gulko, in "Lessons With a Grandmaster." And if your pieces are already well-developed, look for a pawn break.

Improve the position of your worst piece.
if you can’t identify any bad pieces, then That’s bad because you can’t convert a win or because you don’t know whether or not a piece is bad

This sometimes happens to me, especially in the endgame. What should i do in these situations?
Pre Move Checklist:
- Make sure all your pieces are safe.
- Look for forcing moves: Checks, captures, threats. You want to look at ALL forcing moves (even the bad ones) as this will force you look at, and see the entire board.
- If there are no forcing moves, you then want to remove any of your opponent’s pieces from your side of the board.
- If your opponent doesn’t have any of his pieces on your side of the board, then you want to improve the position of your least active piece.
- After each move by your opponent, ask yourself: "What is my opponent trying to do?"

End game I also look at my evaluate pieces and keep eliminating my opponent's pieces,it's very simple impression in my head.
This sometimes happens to me, especially in the endgame. What should i do in these situations?