I've used two techniques to focus stars.
First... keep in mind that everything in space is effectively at "infinity" for a camera. If you can focus on anything, you're focused on everything.
This means that if I can find a bright star ... or the moon... you can point your camera at that for purposes of focus even if that's not in the part of the sky you plan for your shot.
Use a tripod, point it at the bright star, switch to live view, then zoom the live-view to the maximum settings possible. If your camera supports "exposure simulation" in live-view (Canon & Sony have this on pretty much all cameras; Nikon on some cameras) then you can crank up the ISO and shutter duration even though those aren't the exposure settings you plan to use for your shot. This amplifies the image making it easier to see the stars to focus.
Then... rotate the focus ring to the infinity mark (which wont be accurate focus but it will quickly get you into the ballpark. If the camera is well out of focus the stars will be so blurred that you'll see absolutely nothing at all. If you adjust to the infinity mark then you'll be close enough that you should see fuzzy dots on the viewfinder). Next slowly adjust focus while watching live-view to try to bring the stars to a small pin-point.
This takes time. You may fuss with this for several minutes, but it's worth it. I've rushed through the process, confident that I was focused well enough. Shots looked great on that tiny screen on the back of the camera. Then I get home, import the images, look at them on a 27" monitor and ... they're all just a tiny bit soft and you're frustrated and kicking yourself for being rushed.
The other method requires buying a gadget. You can pick up something called a "SharpStar" focusing screen by Lonely Speck.
See:
SharpStar2 Precision Focusing Tool by Lonely Speck – Lonely Speck
This clear piece of resin has grooves etched in it which cause the stars to throw off diffraction spikes in three different directions. When you look at the live-view image, you'll see the spikes probably don't converge at a common center point. That means you're not in focus. But when all three diffraction spikes converge at a common center point, you've nailed focus.
The size of the diffraction spikes depends on how bright the star is and the lens. Sometimes the spikes are too small to be confident that you've nailed focus. If in doubt... just take a short exposure to confirm (e.g. take a 5 or 10 second exposure). These longer exposure times will result in much bigger spikes in your shot then you can see in live-view and can help you confirm that you've nailed focus.
BTW, the focusing mask is in the form of the square "slide in" type filters and requires a filter holder such as a Lee, Cokin, Formatt-Hitech, etc. etc.). If you've never used a filter holder before, you actually need two parts... one is the filter holder itself, but these are generic and you ALSO add an adapter ring for whatever lens size (filter thread diameter) you have. E.g. if your lens uses 77mm filters, then you'd need the holder plus a 77mm adapter ring. You could also just hold the mask flat in front of your lens as you adjust focus (a lot of ultra-wide lenses don't actually have filter threads because they have a non-removable hood.)
Having nailed focus... point the camera at whatever you want to shoot. Don't forget to change the exposure settings back to sane values (so you don't end up with an excessively noisy or blown out shot). Don't forget to remove the focusing screen (not that I've EVER made that mistake <whistles innocently>) and take your perfectly focused shot.