There are two main ways to get an ID in Discord: the easy way and the fast way.
To get an ID normally, you can copy the link of any message (click on the three dots next to a message and click Copy message link). A link is formatted as follows:
With this method you can only get the Server, Channel or Message ID, which brings us to...
This way is a little more complicated to get to (nothing too crazy) because it's hidden behind developer mode. To activate the developer mode, go into the User Settings, then, in the Appearance category, enable Developer Mode under Advanced, like so:
Once it's enabled, you can invoke the context menu (for messages) or right click (for everything else) and click Copy ID to conveniently save the ID to the clipboard, ready to be pasted later.