In this basic chess endgame queen vs pawn you have to know the right technique. To study this position makes only sense if the pawn has advanced already far enough and is sitting right before the last rank and the king is close to the pawn to be able to protect it. Furthermore the white king should be far away as well. Below you see the position that you should be able to win.
If the pawn is not advanced far enough or if the king cannot protect it, then the queen wins without any problems and no further study is required.
The queen on its own can do nothing so it is necessary that the king can help the queen. In this position the queen gives a few checks to force the king to go in front of the pawn, then the pawn cannot move ahead. This way White gains time (one move) to come closer with the queen.
The first moves are: 1.Qe7+ Kf2 2.Qd6 Ke2 3.Qe5+ Kf2 4.Qd4+ ...
The idea is to move ahead with the queen as close as possible then use the same procedure to move the king as close as possible and finally you win the pawn and the game.
If the pawn is on the edge (a-pawn or h-pawn) or if the pawn is on c-file or f-file then the game is a draw as the white king cannot be moved ahead because in the end when the queen has moved up you finally reach a potential stalemate. Then the king cannot be brought closer or it would be a stalemate, which is a draw.
The positions above with the a- and h-pawns or c- and f-pawns will finally reach these positions below. On the left diagram the white king cannot come closer or the black king would be stalemate.
On the right diagram the queen cannot capture the pawn or it would be a stalemate.