At the various levels of a post-graduate career, how much freedom of research will I have?
First, you can always research anything you want on your own time and your own money.  

Thus, I assume that your question boils down to what range of research topics will I be able to get paid for?  That depends heavily on:


Your level of ability.  If you are sufficiently outstanding you can get awards that will fund you to research whatever you want at almost any career stage.  For instance, grad students who have, say, a government fellowship (in the US these are things like NSF, or DOE CSGF) are often given a lot more leeway to pursue their own research agenda.  But such fellowships are rare and highly competitive.  What's more, almost any professor will be willing to take such a student.  At the other end of the pool, if you are a relatively weak student it may be difficult to even find an advisor, and when you do they will probably require you to follow their research plan.  Similarly, a young professor who gets a CAREER award can more easily follow their interests.
Your communication skills.  If you can give persuasive presentations and write excellent grant proposals, you will be able to obtain more funding for the projects that interest you and therefore be free to work on them.  You may also be able to buy yourself out of teaching responsibilities and so spend more time on research.  Of course, this is intertwined with #1 above.
The nature of the research itself.  In experimental or observational areas, you need to buy equipment.  If you want to study gravitational waves (observationally), you will need a lot of money -- or collaborators with a lot of money -- to get started.


Finally, let's talk about career stage.  The three factors above are operative at every career stage.  There are brilliant grad students who can work on just what they want because of their talent, and there are tenured professors who can hardly do research at all because they are required to spend nearly all their time teaching (this may also be a choice -- research is not the top priority for everyone).  That said, on average your freedom to direct your own research increases at each successive stage.  The "restrictions" at each stage are well illustrated by the comic linked in the comments above.