This is a complex topic but here's an attempt at an answer. My background is in describing and documenting relatively small, endangered languages, so I'll describe how it's done in that situation. I'll assume you have computers, software, internet, native speaking informants, recording equipment, and many years to spend on the work.
Firstly, recorded texts are needed, which are transcribed typically using software such as ELAN, and with much help from the native-speaking assistant. The resulting transcript should be time-aligned and have the following annotations at a minimum, each on its own tier:
*a phonemic reperesentation of the text
*a gloss (a very brief definition)
*a free translation
This is known as an interlinear gloss and is a standard analytical approach in linguistics. Here's an example (Western Desert language, Pama-Nyungan):
ngayulu ngurra -kutu ya -nku
1.sg.ERG home -ALL go -FUT
'I'm going homewards'
Another commonly included tier is a part of speech description for each lexical item (presupposing an analysis of the language).
Next this data would be imported into a tool such as Toolbox, FLEx or TshwanaLex. These tools then construct a database of the lexical items. The entry for each item will include the part of speech assignment, the gloss, a fuller definition, and can include many other pieces of information about the entry. These tools typically also enable creating a KWIC (key word in context) concordance which facilitates analysis of the text to discover the full range of meanings and uses of an item.
This 'lexical database' will typically be formatted using FOSF (Field-Oriented Standard Format), aka backslash codes, or at least will enable export/import using FOSF. FOSF consists of a backslash '\' combined with an arbitrary alphanumeric string, followed by the information it categorises. A fairly typical if basic entry would look like this (entry for the word 'papa', Western Desert language):
\lx papa
\pos noun
\def dog
\syn maliki
\xv papangku wati patjarnu
\xe the dog bit the man
\so JS
The codes: \lx = headword (this would also indicate start of a new entry), \pos = part of speech, \def = definition, \syn = synonym, \xv = vernacular example, \xe = english gloss of example, \so = source.
Entries such as this one can have a much more complex structure, including multiple senses. Each sense subentry would begin with a line such as \se1 (for the first sense), followed by its own \def, \syn, etc lines within the entry, as appropriate.
There is a variety of software that can take a regularly-structured FOSF lexical database and convert it into a nicely formatted dictionary. One easy to use software to do this that is currently popular is Lexique Pro, although ToolBox and FLEx can also do this conversion.