I agree that this is a broad question.
I'm assuming by your question you know what the purpose of roleplaying is. So, D&D specifically is a game in which the mechanics are designed such that through roleplaying and the use of different dice [d4, d6, d8, d10, d12, d20, d100 (commonly called d%)] a story can be told in which a mutually agreed upon outcome is desired but not entirely assured. The outcome can be as broad as "live till I'm old and gray" or as narrow as "Slay the red dragon and everything in my path to it."
The mechanics of this process can be learned through the above links. Every different Game Master (or Dungeon Master) has a slightly different approach ... having the effect of making every game truly unique. Every different player also has different likes/dislikes/habits/approaches thus adding even more uniqueness.
Honestly, anything more detailed than that should probably be gleaned from the above links or asked more directly.
And ... welcome to the boards (and presumably) the game. I'f you would like to get a bit of a feel of how a game functions you can feel free to read through any of my games found in my sig (although please refrain from posting in an IC (In Character) thread. That will give you an idea of how a specific game called a PbP (Play by Post) works. It is a rough facsimile of a FtF (Face to Face, or Table Top) game. PbPs and FtFs each have their unique strengths and weaknesses.