It takes a lot of practice. Finding a guided meditation for beginners where you’re being reminded to breathe consistently can help. Also starting with short meditations (1-5 minutes) can help you learn to do longer ones. And it’s okay to acknowledge your restlessness, to say, “This is what I’m feeling right now, and that’s okay.” Remember, even just a few seconds of purposeful breathing can be meditation and can make a difference. Keep in mind, too, not everyone gets the same thing out of meditation. You need to modify it to work for you, or just accept it’s maybe not what you need right now.
Sit in the position you feel most comfortable in and relax as best you can. Try some deep breaths as well. They will help.
I have anxiety and often can’t relax enough to meditate on a whim. If there’s anything urgent I need to do, I take care of that first so it’s not on my mind as much. I also try to make sure I’m physically comfortable and in a place where I’m unlikely to be interrupted. Sometimes exercise (even going for a walk) helps me get into the right state of mind.