How to tell if an EPUB has DRM
Open the EPUB as a ZIP archive and look in its META-INF folder for a file called encryption.xml. If it isn't there, nothing in the book is encrypted: the EPUB 3.3 specification says that file is required whenever any resource is. If it is there, read each entry as a pair: the Algorithm attribute, and the file it applies to. An entry that scrambles a font file (.otf, .ttf, .woff) only makes the font harder to lift out of the book; the standard value for this is http://www.idpf.org/2008/embedding. An entry that encrypts a chapter means the text is locked, and that's DRM.
The name of the file proves nothing. A locked EPUB still ends in .epub, unpacks like any other ZIP, and shows every chapter by its file name, because the standard encrypts each file on its own and leaves the names alone.
Clues before you open the file
The shop often tells you first. Kobo's file formats page says that EPUB or PDF books "with an ACSM file extension are protected" by DRM, and its Adobe Digital Editions page says a protected book will "usually" come down as a .acsm file. That file is a ticket, not the book (what an ACSM file is), and the EPUB that Adobe Digital Editions fetches with it is locked. The word "usually" matters, though: a file that arrived as a plain .epub can still be protected, so the check below is the one that settles it. The steps for Kobo purchases, and which file you get, are in how to download your Kobo purchases.
A watermark is a different thing. A book with social DRM carries the buyer's name or an order number but isn't encrypted, so the test here calls it DRM-free, and any app can open it.
Read encryption.xml on a Mac
Terminal does it in two commands. The first lists what the archive holds:
unzip -l "Book.epub"
If META-INF/encryption.xml isn't in the list, you're done: the book has no encrypted files. If it is, print it:
unzip -p "Book.epub" META-INF/encryption.xml
The specification builds this file on the W3C's XML Encryption standard, and an EncryptedData element describes each encrypted file. Inside each one, EncryptionMethod names the algorithm and CipherReference gives the path of the file it applies to. An AES algorithm on OEBPS/chapter01.xhtml is DRM; the IDPF embedding algorithm on a .otf file is not.
The same section lists the files that must never be encrypted: mimetype, container.xml, encryption.xml itself, and the package document among them. That's why a locked book still shows its file list and its metadata. The post on what's inside an EPUB explains what each of those files does.
The specification also reserves a file called rights.xml in META-INF for rights information, without giving it a structure. Its presence tells you little: encryption.xml is the file that says whether anything is locked.
Fonts that look encrypted and aren't
A book that embeds a font can obfuscate it, a step the specification hopes will satisfy font vendors. The method in section 4.4 of the specification scrambles the start of the font file with a key made from the book's own unique identifier. It is listed in encryption.xml with the algorithm http://www.idpf.org/2008/embedding, so a quick look can mistake it for DRM. The specification is careful on this point: it "does not claim that obfuscation constitutes encryption". The text itself is untouched, and the specification even allows a reading app that skips the unscrambling, which is one reason a book's fonts can look different from app to app.
A book locked with Readium LCP
Readium LCP, another DRM system, keeps a few more files readable than the EPUB specification asks. Its specification puts the licence at META-INF/license.lcpl, so that file's presence alone tells you the book is under LCP. It also keeps the navigation document, any NCX, and the cover image unencrypted. An LCP book can therefore show a cover and a full table of contents in a library app and still refuse to open its chapters. In encryption.xml, each entry's key points back into the licence (license.lcpl#/encryption/content_key).
Checking a whole library
Opening books one at a time doesn't scale. Readwyn, the library app this blog belongs to, runs the same test on every EPUB it holds: in “Library health” in the sidebar, the tab “Checks” has a group “Files” with a check called “DRM”, which lists each EPUB whose encryption.xml names an algorithm other than font obfuscation. It treats two values as fonts: the IDPF one above, and Adobe's http://ns.adobe.com/pdf/enc#RC. It doesn't remove the DRM, and it doesn't convert a locked file. Whether removing it is lawful where you live is a separate question, answered in is it legal to remove DRM.