Player-run strongholds and castles are sort of a waning art these days. At least, I perceive it that way. Does the 4e PHB or DMG even mention the possibility?
In OD&D, the books for which I've been poking through lately, PCs had the ability to buy land whenever they had the cash. Once reaching a certain level (Nine or ten, I think), they could become nobility, and begin collecting taxes on their newly granted land. There were specified costs for walls, crenelations, towers, gates, and all sorts of other things. There were methods and information about finding specialists to join your work there, as well as hiring large bands of mercenaries to defend the place. It was an assumed endgame for the party to get into, once they had gone through the adventuring life for a time.
I've had a couple campaigns where the players became invested enough in the world to begin constructing fortifications and castles. It's certainly possible with 3.5 rules, and reasonably possible with 4e, if you don't feel overly pressured to stick to the treasure distribution in the book. However, be wary of allowing players to make a huge castle on a big land grant right away. Such a change in the campaign requires a lot of forethought, as well as raising a great number of issues in fairly short order.
Firstly, you have to consider how nobility and land ownership worked in older times. One, in most feudal societies, land was all owned by the king outright. However, he had the ability to grant land to noblemen, and possibly to non-nobles. Nobility is a virtue of birth. Your fighting-man (heh) can't become a baron by virtue of owning land and building a castle, unless he is adopted into a noble family, or the king just feels like granting him nobility outright. The latter is dangerous, as it disrupts social order if every Tom, Dick, and Harry can become a nobleman. Though to be honest, 'Baron' is such a weak title as to mostly hold the status quo while being given to erstwhile commoners. It was created for this purpose. Thus, either the PC gaining nobility and land has to be adopted into a family that will doubtlessly require more service of him than they would a blooded relative, or he must be extraordinarily lucky. I suppose he could also constantly serve the king, give him everything he wants, and exalt him everywhere he goes. That might curry enough favor also. Just up and buying a large enough plot of land to place a castle on is right out. The land isn't for sale, as the only person with the real rights to sell it is the King, and he does not care for the pittance the PC has to offer. Besides, any non-noble building a castle would be seen as, at least, pretentious. At worst, he would be seen as seceding, and declared a traitor to the crown.
Once made a low-ranking nobleman and granted some presumably derelict and near-lawless land, the new Baron must first see to the security and well-being of his people. Of course, living on 'his' land means that they all owe him fealty. However, if they have previously been ignored by the crown, harassed by bandits, and generally having a rough time of it, they won't bow to any nobleman coming in without good reason. They may not openly revolt, but they won't work willingly, and what work they are made to do will be slow and low quality.
Note that "I can kill everyone in this village in less than a minute" is not a good reason for gaining loyalty.
Anyway, at this point, the campaign likely takes a turn towards above ground work. The party will have to either patrol the PCs' new land themselves, or hire others to do it. They need to root out threats, kill dragons, slaughter or drive off bandits, genocide the orcs, make the roads safe, and generally raise the standard of living noticeably. How long does this take? It depends on how dangerous the land is, how large the fief is, and a million other factors. The best course of action would likely be to hire mercenaries (respectable ones) to come the land, and report problems they can't handle alone. Then, the PCs can go clean those special issues up.
Once the land is safe and good again, and perhaps the people are better provided for, they will be much more willing to swear fealty and vassalage to the new lord. Of course, the vast majority of the population is comprised of moronic peasants and serfs. They know little but what their lives consist of, which is farming and breeding. There may be a small village, with a few folk who are wealthy enough to actually own the building that they live in, and thus are able to ply a trade. Blacksmiths, alchemists, tanners, brewers, coopers, fletchers, bowyers, etc etc. There are dozens of trades available. At the least, there are those who can construct sturdy buildings of either wood or stone, a couple of people capable of making at least simple farm tools from metal, and perhaps a few more advanced trades.
Good, now the PC has some lands that are slowly (read: over a few years) becoming profitable again. Now he must see to a more stable and, more importantly, visible hold of power and security in the region. That means a fortress or castle of some variety.
Castles are commonly depicted in a number of works as lonely forts up on a mountain island or somesuch. While certainly possible, and incredibly defensible, this is not the most convenient or even effective place to build a castle. Fortresses are built to help slow the destruction of the populace and goods of the fief during times of war. The common people (some of them, the most worthwhile) will retreat to the castle when times are exceedingly bad. A castle must therefore be capable of being reached by a large number of people on fairly short notice. Secondly, it must be able to store a great deal of food and water, as to withstand a siege until help can arrive. It also needs to actually be possible to construct in a single lifetime, if the PC wants to ever see his work done. Thus, it's not a good idea to place the thing on the edge of your lands, on an island off the coast, or on top of a mountain.
Now that you have chosen a nice flat, well-grounded, and reasonable place for your fortress, how do you build it? Certainly, large structures like this are not short-term constructions. It will take years upon years for normal humans to fabricate a structure like this. Of course, your players probably want to go adventuring again at this point, and don't care to stand around directing laborers for years of game time. One will assume the DM allows the players to have access to a quarry, as well as transport for the stone, wood, and hundreds of other materials required.
Thankfully, D&D makes castle building a bit easier, since there are mages and clerics that can help. Hiring a high-level caster (or being one) can shorten construction easily. Spells to consider are Mass Haste, Wall of Stone, Fabricate, Polymorph Other, and numerous others. Let's say you have a typical mason/stoneworker. He's able to craft a rough rock into a usable stone block in perhaps a few hours, if he's skilled and the work goes smoothly. Now, you have a level five cleric cast a few spells. Your typical STR, DEX, and WIS buffs. Suddenly, the mason is twice as capable as any other. He's gone from a master craftsman to a legend in his own time. You have to consider than a master craftsman still has 10's or 11's across the board as abilities. This guy suddenly has 13 or 14 all over. He works twice as fast, and his products are ten times as good. He has less waste and doesn't tire as quickly. These spells have "Mass" variants, in some splats, and can be extended to day-long duration. Of course, mid-level clerics aren't free. What the PC can do to make it easier, of course, is to include a chapel in his fortress. Doing such due service to the gods can make working with clerics of the same god a lot cheaper, though by no means free.
With magic and whatnot, one can have a reasonable fortress built rather quickly, probably on the order of just a year or two. This will leave your serfs and craftsmen exhausted, but a good deal wealthier (with your money) than their neighbors in adjacent lands. This makes them happy, but also attracts banditry. Opposition is good! It fuels adventures! Also it gives players a reason to start hiring men-at-arms to watch the walls and patrol the roads.
At this point, the player is receiving taxes from his vassals and serfs. Taxes, especially in the early medieval age, were not only money. They were produce, meat, crafts, wood, metalworks, and numerous other things besides. Still, for D&D, it's probably easier to abstract this as some percentage of money generated by the lands. This money should probably be poured largely back into the land itself, maintaining roads, irrigation if it exists, security, and military. The player of course can feel free to keep a percentage of it, but he has his obligations now. Of course, other people can be hired to manage things.
Here, you must make a decision. Depending on your players and what they enjoy, they may get really into running their lands. They might want resource counts, population information, abilities to form mining groups and lumber camps, all kinds of intricate taxation and tariffs, etc. etc. That's certainly possible, but starts to move the game rather quickly away from D&D, in a large sense. If your players tend to hand-wave working on the fort, then let them hire people for a monthly/yearly wage (depending on how time flows in your campaign, they may instead ask for pay upfront). These people can be trusted as much as any civil servant, to manage the lands to the best of their ability. They have a vested interest in keeping it running well. This frees up the players themselves to go dungeon-delving again, or to go finish the plot of the campaign, or whatever else. Of course, the less supervision a paid administrator has, the more likely corruption sets in. Either route is fine, just try to see what your players enjoy.
I hope this sort of very limited scope essay at least makes you think about permitting or encouraging castle usage in your campaign. Though yes, it's largely incompatible with a heavily plot-driven campaign, it can add a lot of flavor and interesting adventure hooks to a more sandbox sort of deal. Good luck!
The GM’s Agenda and Principles
17 hours ago