The anatomy of a LaTeX table
A LaTeX table is two environments, one inside the other. The outer table is a float: it holds the caption and label, and LaTeX moves it to wherever it fits best on the page. The inner tabular is the grid itself. You can use a tabular on its own, but then it can't take a caption and stays exactly where you typed it, even if that leaves a half-empty page.
The tabular's argument lists one letter per column: l, c or r for left, centered or right, and p{3cm} for a column of fixed width whose text wraps onto several lines. Inside, & separates cells and \\ ends a row. A row must never have more cells than the letters allow, which is the cause of most table errors. The float's placement letters, like [htbp], say where LaTeX may put it: here, top of a page, bottom of a page, or a page of floats. Giving all four lets LaTeX choose.
Here is the code the tool writes for the table it opens with, a pendulum's period at three lengths. It starts with a comment, % \usepackage{booktabs}, to remind you which package the preamble needs. Then \begin{table}[htbp] opens the float, \centering centers it, and \caption{Pendulum period by length} and \label{tab:pendulum} follow, in that order. \begin{tabular}{lrr} sets up three columns: the trial number on the left and the two measurements on the right, so their decimal points line up.
Inside, \toprule draws the heavy top line, the heading row reads \textbf{Trial} & \textbf{Length (m)} & \textbf{Period (s)} \\, and \midrule separates it from the data. The data rows are 1 & 0.25 & 1.00 \\ then 2 & 0.50 & 1.42 \\ then 3 & 1.00 & 2.01 \\. Finally \bottomrule closes the grid, and \end{tabular} and \end{table} close the environments. The periods come from T = 2π√(L/g) with g = 9.81 m/s², rounded to two decimal places.
The label is what lets you write Table~\ref{tab:pendulum} in your text and get the right number, even after tables are added or moved. It has to come after the caption, because \label picks up the most recent number LaTeX has assigned: put it first and \ref prints the section number instead. References also need two runs of LaTeX to settle, which is why a fresh one shows ?? until you compile again.
Why booktabs tables look more professional
LaTeX's own \hline draws every line the same weight with almost no space around it, so the text sits cramped against the rules. The booktabs package replaces it with three rules: \toprule and \bottomrule, which are heavier, and a lighter \midrule under the headings. They also leave a little vertical space between each rule and the text, which is most of why a booktabs table looks like it came out of a journal.
The package's documentation by Simon Fear is blunt about the rest. Its first two guidelines for a formal table are to never, ever use vertical rules, and never use double rules. It also advises putting units in the column heading rather than repeating them in every cell, always writing a digit before a decimal point (0.1, not .1), and never using ditto marks. If the two halves of a table seem to need a vertical line between them, Fear suggests they should be two tables.
For grouped headings, booktabs adds \cmidrule, a thin rule under part of a row. When you merge heading cells with this tool and use two heading rows, it writes \multicolumn{2}{c}{...} over the group and \cmidrule(lr){2-3} beneath it. The (lr) trims both ends slightly, so two group rules side by side don't run into each other.
One spacing detail: booktabs puts no space above \toprule by default, so a caption placed above the table can sit tight against the top rule. The documentation suggests setting \abovetopsep in your preamble, for example \setlength{\abovetopsep}{4pt}, rather than adding \vspace to every table. The caption package can fix it too, with its tableposition=top option. The grid style is still here for the times a teacher or template asks for every line, but if the choice is yours, booktabs is the better default.
Common errors and how to fix them
Misplaced alignment tab character &. LaTeX reads & as a cell separator, so a bare & anywhere outside a tabular, such as a caption reading R&D, stops the compile with this message. Inside a tabular a stray & quietly pushes the rest of the row one column to the right, or, if the row is already full, causes the Extra alignment tab error described below. Write \& when you mean the symbol. The tool does this for you in cells and captions.
Unescaped % and _. A % starts a comment, so LaTeX ignores the rest of that line, including the \\ that ends the row, and the next row runs into it. An underscore only means something in math mode, so a cell like x_1 stops the compile with Missing $ inserted. With escaping on, Growth (%) becomes Growth (\%) and x_1 becomes x\_1. The same goes for $, #, {, }, ~, ^ and the backslash. If your cells are meant to contain math, turn escaping off and write it as $x_1$ yourself; the tool then flags an unescaped & or %, an unclosed $ or unbalanced braces before you hit compile.
Extra alignment tab has been changed to \cr. A row has more cells than the column specification allows: {lrr} takes three cells, so two & per row. Count the letters and the &s, or let the tool write both from the same grid so they can't disagree. A missing \\ at the end of a row causes the same error, because the next row's cells are added onto it.
LaTeX doesn't recognize \toprule. If the compile stops at \toprule, \midrule or \bottomrule and says the control sequence isn't defined, the booktabs package isn't loaded. Add \usepackage{booktabs} to the preamble, between \documentclass and \begin{document}. The top comment in the generated code lists every package the table needs; the float package appears only when you choose [H] placement, which pins the table exactly where it is in the text.
Wide tables, and pasting from spreadsheets
When a table is wider than the text block, start by making it smaller honestly: shorter headings with the units in them, fewer columns, or the \small or \footnotesize option. For columns of prose, switch them to wrapped p columns with a fixed width. For a table that should fill the line exactly, the tabularx package's X columns share out whatever width you give, as in \begin{tabularx}{\textwidth}{lXX}.
It is tempting to wrap the tabular in \resizebox{\textwidth}{!}{...} from the graphicx package. It works, but it scales the text along with the lines, so the table ends up in a font size that matches nothing else in the document, and a wide table can shrink to unreadable. Use it as a last resort. For a genuinely wide table, turn it sideways instead: the rotating package's sidewaystable environment puts it on a page of its own in landscape, and the landscape environment from pdflscape also rotates the page in PDF viewers. A table that runs over several pages needs the longtable package.
To bring data in from Excel or Google Sheets, select the cells and copy. The clipboard holds them as tab-separated text, with any cell that contains a line break wrapped in quotes, and that's what the paste box reads; it also takes CSV with commas or semicolons and Markdown tables. You can paste straight into any cell of the grid too, and it fills from there like a spreadsheet. Columns that hold only numbers are right-aligned for you. Round the numbers in the spreadsheet first, since a copy carries what the cell displays, not the full value behind it. If you need numbers aligned on the decimal point, the siunitx package's S column does that.
Tables of results often sit next to equations. For those, the LaTeX equation editor previews an expression as you type, so you can paste it into a cell with escaping turned off.