Re-apply to a PhD position that is re-posted after being rejected?
First of all, can you be sure it is exactly the same position? The same professor might have just gotten another grant which can fund another PhD position; it is then possible that they announced the second position with an (almost) identical ad. If that is the case, you can still have a chance of being accepted if you apply. If not and it's indeed the same position, it'll be much more difficult.

If it's a second position with the same professor, it means that the search for a suitable candidate starts anew. Being rejected with the previous application then isn't really a problem—it just means there was at least one candidate better than you. With a new hiring process, the selection starts from a beginning and it can happen that you'll be the best candidate this time. If, on the other hand, it's the same position, none of the candidates was a good fit for the job; and that doesn't change now unless you can change a part of your application (like your cover letter).

In my opinion, you cannot go wrong by sending a brief, polite email to the professor and asking about the new ad and potentially for a short feedback on your application. The worst that can happen is that you'll get no response at all, and then it's probably not a good idea to apply.