text:
Zeroes at the end of a factorial
Write a program or function that finds the number of zeroes at the end of n! in base 10, where n is an input number (in any desired format).
It can be assumed that n is a positive integer, meaning that n! is also an integer. There are no zeroes after a decimal point in n!. Also, it can be assumed that your programming language can handle the value of n and n!.

Test cases
1
==> 0

5
==> 1

100
==> 24

666
==> 165

2016
==> 502

1234567891011121314151617181920
==> 308641972752780328537904295461

This is code golf. Standard rules apply. The shortest code in bytes wins.

Related.

Can we assume that n! will fit within our languages' native integer type?

@AlexA. Yes you can.

Can n be an input string?

@CᴏɴᴏʀO'Bʀɪᴇɴ Yes.

I think this would be a better question if you were not allowed to assume n! would fit into your integer type! Well, maybe another time.

@ASimmons Most of the answers so far, or at least the ones that use the floor division trick, don't rely on that assumption anyway.

https://oeis.org/A027868

I was wondering this today as well after seeing a number of ways a pack of cards can be shuffled.

Also of interest: Last non-zero digit of n!.

Python 2, 27 bytes
f=lambda n:n and n/5+f(n/5)

The ending zeroes are limited by factors of 5. The number of multiples of 5 that are at most n is n/5 (with floor division), but this doesn't count the repeated factors in multiples of 25, 125, .... To get those, divide n by 5 and recurse.

Mornington Crescent, 1949 1909 1873 bytes
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Parsons Green
Take District Line to Cannon Street
Take Circle Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Turnham Green
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Turnham Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Blackfriars
Take Circle Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Upney
Take District Line to Upminster
Take District Line to Upney
Take District Line to Upminster
Take District Line to Upney
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Blackfriars
Take District Line to Upminster
Take District Line to Temple
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Bank
Take Circle Line to Blackfriars
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Cannon Street
Take District Line to Upney
Take District Line to Cannon Street
Take District Line to Upney
Take District Line to Blackfriars
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Upney
Take District Line to Upminster
Take District Line to Upney
Take District Line to Upminster
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Angel
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent

Try it online!
-40 bytes thanks to NieDzejkob
-45 bytes thanks to Cloudy7

And this is now my most upvoted answer.

A brief explanation for those of us who are Mornington Crescent-challenged would be cool. :)

-40 bytes by using shorter line names where possible.

-45 bytes by using Upney instead of Becontree.

Yeah, I wasn't very efficient at choosing station names when I wrote this code in 2016.

Jelly, 5 bytes
!Æfċ5

Uses the counterproductive approach of finding the factorial then factorising it again, checking for the exponent of 5 in the prime factorisation.
Try it online!
!              Factorial
 Æf            List of prime factors, e.g. 120 -> [2, 2, 2, 3, 5]
   ċ5          Count number of 5s

yikes. Talk about trade-offs! To get the code down to 5 bytes, increase the memory and time by absurd amounts.

Pyth, 6 bytes
/P.!Q5

Try it here.
/    5   Count 5's in
 P        the prime factorization of
  .!Q      the factorial of the input.

Alternative 7-byte:
st.u/N5

The cumulative reduce .u/N5 repeatedly floor-divides by 5 until it gets a repeat, which in this case happens after it hits 0.
34 -> [34, 6, 1, 0]

The first element is then removed (t) and the rest is summed (s).

Actually, 10 bytes
!$R;≈$l@l-

Try it online!
Note that the last test case fails when running Seriously on CPython because math.factorial uses a C extension (which is limited to 64-bit integers). Running Seriously on PyPy works fine, though.
Explanation:
!$R;≈$l@l-
!           factorial of input
 $R         stringify, reverse
   ;≈$      make a copy, cast to int, then back to string (removes leading zeroes)
      l@l-  difference in lengths (the number of leading zeroes removed by the int conversion)

Oh wow, I like how this method doesn't use the dividing by 5 trick.

I count 12 bytes on this one

@Score_Under Actually uses the CP437 code page, not UTF-8. Each character is one byte.

Haskell, 26 bytes
f 0=0
f n=(+)=<<f$div n 5

Floor-divides the input by 5, then adds the result to the function called on it. The expression (+)=<<f takes an input x and outputs x+(f x).
Shortened from:
f 0=0
f n=div n 5+f(div n 5)

f 0=0
f n|k<-div n 5=k+f k

A non-recursive expression gave 28 bytes:
f n=sum[n`div`5^i|i<-[1..n]]

Is i a counter from 1..n?

@CᴏɴᴏʀO'Bʀɪᴇɴ Yes, though only up to log_5(n) matters, the rest gives 0.

MATL, 9 bytes
:"@Yf5=vs

Try it online!
This works for very large numbers, as it avoids computing the factorial.
Like other answers, this exploits the fact that the number of times 2 appears as divisor of the factorial is greater or equal than the number of times 5 appears.
:     % Implicit input. Inclusive range from 1 to that
"     % For each
  @   %   Push that value
  Yf  %   Array of prime factors
  5=  %   True for 5, false otherwise
  v   %   Concatenate vertically all stack contents
  s   %   Sum

05AB1E, 5 bytes
Would be 4 bytes if we could guarantee n>4
Code:
Î!Ó7è

Explanation:
Î        # push 0 then input
  !      # factorial of n: 10 -> 2628800
   Ó     # get primefactor exponents -> [8, 4, 2, 1]
    7è   # get list[7] (list is indexed as string) -> 2
         # implicit output of number of 5s or 0 if n < 5

Alternate, much faster, 6 byte solution: Inspired by Luis Mendo's MATL answer
LÒ€`5QO

Explanation:
L         # push range(1,n) inclusive, n=10 -> [1,2,3,4,5,6,7,8,9,10]
 Ò        # push prime factors of each number in list -> [[], [2], [3], [2, 2], [5], [2, 3], [7], [2, 2, 2], [3, 3], [2, 5]]
  €`      # flatten list of lists to list [2, 3, 2, 2, 5, 2, 3, 7, 2, 2, 2, 3, 3, 2, 5]
    5Q    # and compare each number to 5 -> [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
      O   # sum -> 2

Edit: removed solutions using ¢ (count) as all primes containing 5 would be counted as 5 e.g. 53.
Edit 2: added a more efficient solution for higher input as comparison.

Yeah, instead of 5¢, 5Q should work. Nice answer though! :)

I was going to test on larger inputs with the comment "wouldn't this fail if the output was > 9", but boy 05AB1E's implementation of Ó is slow

Btw, the first code can also be Î!Ó2é. The bug was fixed yesterday.

If you're using utf-8, Î!Ó7è is 8 bytes, and the "6 byte" solution is 10 bytes

@Score_Under Yes that is correct. However, 05AB1E uses the CP-1252 encoding.

Matlab  (59) (54)(39)
Hey dawg !!!! we heard you like maths ....
  @(n)sum(fix(n./5.^(1:fix(log(n)/1.6))))

This is based on my created answer in code review.
further than what is mentioned in my answer in code review, the formula for number of zeros in factorial(n) is Sum(n/(5^k)) where k varies between 1 and log_5(n)
The only trivial reason why it cant get golfier is that log5 isnt available in matlab as a builtin , thus I replaced log(5) by 1.6, doesnt matter because it will be anyways floored.

Give it a try

A couple of questions. 1.  How do you actually run this in Matlab? 2. What is the result for n=1?

@StuartBruff to run this type ans(1) and it does return 0.

OK.  Thanks.  Interesting.  I haven't used function handles much in Matlab, so was a little puzzled as to how to run it ... why doesn't the ans() count towards the total?  Neat answer though, I tried it in Mathcad but had to modify the upper limit of the sum as Mathcad autodecrements the summation variable if the "upper" is less than the "lower" limit (and hence my question about 0).

Julia, 34 31 30 bytes
n->find(digits(prod(1:n)))[]-1

This is an anonymous function that accepts any signed integer type and returns an integer. To call it, assign it to a variable. The larger test cases require passing n as a larger type, such as a BigInt.
We compute the factorial of n (manually using prod is shorter than the built-in factorial), get an array of its digits in reverse order, find the indices of the nonzero elements, get the first such index, and subtract 1.
Try it online! (includes all but the last test case because the last takes too long)
Saved a byte thanks to Dennis!

Mathematica, 20 bytes
IntegerExponent[#!]&

IntegerExponent counts the zeros. For fun, here's a version that doesn't calculate the factorial:
Tr[#~IntegerExponent~5&~Array~#]&

I think Array saves a byte on the second solution.

C, 28 bytes
f(n){return(n/=5)?n+f(n):n;}

Explanation
The number of trailing zeros is equal to the number of fives that make up the factorial.  Of all the 1..n, one-fifth of them contribute a five, so we start with n/5.  Of these n/5, a fifth are multiples of 25, so contribute an extra five, and so on.  We end up with f(n) = n/5 + n/25 + n/125 + ..., which is f(n) = n/5 + f(n/5).  We do need to terminate the recursion when n reaches zero; also we take advantage of the sequence point at ?: to divide n before the addition.
As a bonus, this code is much faster than that which visits each 1..n (and much, much faster than computing the factorial).
Test program
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char **argv) {
    while(*++argv) {
        int i = atoi(*argv);
        printf("%d: %d\n",i,f(i));
    }
}

Test output

1: 0
  4: 0
  5: 1
  24: 4
  25: 6
  124: 28
  125: 31
  666: 165
  2016: 502
  2147483644: 536870901
  2147483647: 536870902

+1 for an excellent explanation

C, 36
r;f(n){for(r=0;n/=5;)r+=n;return r;}

Same method as @xnor's answer of counting 5s, but just using a simple for loop instead of recursion.
Ideone.

@TobySpeight there you go.

suggestion: omit r=0, since globals are zeroed by default.

JavaScript ES6, 20 bytes
f=x=>x&&x/5+f(x/5)|0

Same tactic as in xnor's answer, but shorter.

Jelly, 3 bytes
!ọ5

Try it online!
How it works
!ọ5 - Main link. Takes n on the left
!   - Yield n!
 ọ5 - How many times is it divisible by 5?

Retina, 33 bytes
Takes input in unary.
Returns output in unary.

+`^(?=1)(1{5})*1*
$#1$*1;$#1$*
;

(Note the trailing linefeed.)
Try it online!
How it works:
The first stage:
+`^(?=1)(1{5})*1*
$#1$*1;$#1$*

Slightly ungolfed:
+`^(?=1)(11111)*1*\b
$#1$*1;$#1$*1

What it does:

Firstly, find the greatest number of 11111 that can be matched.
Replace by that number
Effectively floor-divides by 5.
The lookahead (?=1) assures that the number is positive.
The +` means repeat until idempotent.
So, the first stage is "repeated floor-division by 5"

If the input is 100 (in unary), then the text is now:
;;1111;11111111111111111111

Second stage:

;

Just removes all semi-colons.

Perl 6, 23 bytes
{[+] -$_,$_,*div 5…0}
{sum -$_,$_,*div 5...0}

I could get it shorter if ^... was added to Perl 6 {sum $_,*div 5^...0}.
It should be more memory efficient for larger numbers if you added a lazy modifier between sum and the sequence generator.
Explanation:
{ # implicitly uses $_ as its parameter
  sum

    # produce a sequence
    -$_,     # negate the next value
     $_,     # start of the sequence

     * div 5 # Whatever lambda that floor divides its input by 5

             # the input being the previous value in the sequence,
             # and the result gets appended to the sequence

     ...     # continue to do that until:

     0       # it reaches 0
}

Test:
#! /usr/bin/env perl6

use v6.c;
use Test;

my @test = (
     1,   0,
     5,   1,
   100,  24,
   666, 165,
  2016, 502,
  1234567891011121314151617181920,
        308641972752780328537904295461,

  # [*] 5 xx 100
  7888609052210118054117285652827862296732064351090230047702789306640625,
        1972152263052529513529321413206965574183016087772557511925697326660156,
);

plan @test / 2;

# make it a postfix operator, because why not
my &postfix:<!0> = {[+] -$_,$_,*div 5...0}

for @test -> $input, $expected {
  is $input!0, $expected, "$input => $expected"
}

diag "runs in {now - INIT now} seconds"

1..7
ok 1 - 1 => 0
ok 2 - 5 => 1
ok 3 - 100 => 24
ok 4 - 666 => 165
ok 5 - 2016 => 502
ok 6 - 1234567891011121314151617181920 => 308641972752780328537904295461
ok 7 - 7888609052210118054117285652827862296732064351090230047702789306640625 => 1972152263052529513529321413206965574183016087772557511925697326660156
# runs in 0.0252692 seconds

( That last line is slightly misleading, as MoarVM has to start, load the Perl 6 compiler and runtime, compile the code, and run it. So it actually takes about a second and a half in total.
That is still significantly faster than it was to check the result of the last test with WolframAlpha.com )

Mathcad, [tbd] bytes

Mathcad is sort of mathematical "whiteboard" that allows 2D entry of expressions, text and plots. It uses mathematical symbols for many operations, such as summation, differentiation and integration.   Programming operators are special symbols, usually entered as single keyboard combinations of control and/or shift on a standard key.
What you see above is exactly how the Mathcad worksheet looks as it is typed in and as Mathcad evaluates it.   For example, changing n from 2016 to any other value will cause Mathcad to update the result from 502 to whatever the new value is.
http://www.ptc.com/engineering-math-software/mathcad/free-download

Mathcad's byte equivalence scoring method is yet to be determined.  Taking a symbol equivalence, the solution takes about 24 "bytes" (the while operator can only be entered using the "ctl-]" key combination (or from a toolbar)).  Agawa001's Matlab method takes about 37 bytes when translated into Mathcad (the summation operator is entered by ctl-shft-$).

Sounds a stunning tool to handle, I wont spare a second downloading it !

Ruby, 22 bytes
One of the few times where the Ruby 0 being truthy is a problem for byte count.
f=->n{n>0?f[n/=5]+n:0}

wait why is 0 truthy?

@CᴏɴᴏʀO'Bʀɪᴇɴ In Ruby, nil and false are falsey, and nothing else is. There are a lot of cases where helps out in golf, since having 0 be truthy means the index and regex index functions in Ruby return nil if there is no match instead of -1, and some where it is a problem, like empty strings still being truthy.

@KevinLau-notKenny That does make sense.

dc, 12 bytes
[5/dd0<f+]sf

This defines a function f which consumes its input from top of stack, and leaves its output at top of stack. See my C answer for the mathematical basis.  We repeatedly divide by 5, accumulating the values on the stack, then add all the results:
5/d   # divide by 5, and leave a copy behind
d0<   # still greater than zero?
f+    # if so, apply f to the new value and add

Test program
# read input values
?
# print prefix
[  # for each value
    # print prefix
    [> ]ndn[ ==> ]n
    # call f(n)
    lfx
    # print suffix
    n[
]n
    # repeat for each value on stack
    z0<t
]
# define and run test function 't'
dstx

Test output
./79762.dc <<<'1234567891011121314151617181920 2016 666 125 124 25 24 5 4 1'

1 ==> 0
4 ==> 0
5 ==> 1
24 ==> 4
25 ==> 6
124 ==> 28
125 ==> 31
666 ==> 165
2016 ==> 502
1234567891011121314151617181920 ==> 308641972752780328537904295461

Julia, 21 19 bytes
!n=n<5?0:!(n÷=5)+n

Uses the recursive formula from xnor's answer.
Try it online!

Vyxal s, 5 bytes
ɾǐƛ5O  # main program

ɾ      # range over input
 ǐ     # take the prime factors of each number
  ƛ5O  # for each value, count the 5s
-s     # sum top of stack

Try it Online!
Vyxal, 3 bytes
¡5Ǒ

This one uses the same approach as caird coinheringaahing's answer
Try it Online!
Vyxal l, 3 bytes (for inputs > 4)
¡Ġt

Approach by Lyxal, takes the factorial of the input, groups by consecutive, then gets the length of the tail using the -l flag.
Try it Online!

Alternate 3 bytes that isn't a caird port

@lyxal added it

The last one doesn't work for inputs <=5, where there are no trailing 0's

@ovs true, I'll add a comment about that

asm2bf, 32 bytes
@f
divr1,5
addr2,r1
jnzr1,%f
ret

Resulting brainfuck code (~500 bytes):
+>+[<[>-]>[>]>+<<<[>>>[-]<-<<-]+>>+[-<[>+>-<<-]>>[<<<->>[<+
>>+<-]>[-]]<[-]]<<[>>+<<-]>>[-<<+>>>>>>>>>+++++[>>>>+<<<<-]
<<<<[>>>>>>>+>-[>>]<[[>+<-]<+>>>]<<<<<<<<<-]>>>>>>[<<<<<<+>
>>>>>-]>[<<<+>>>-]>[<<<<+>>>>-]<<<<[-]<<<<[>+<<+>-]<[>+<-]>
>>>>+<<<<[<<<<<[-]>>>>>>>>>[<<<<<<<<+>+>>>>>>>-]<<<<<<<[>>>
>>>>+<<<<<<<-]>>>[<<<+>>>-]]<<<[>>>+<<<-]>>>>>>>[-]<<<<<<<]
<<[>>+<<-]>>[-<<+[-]>[-]>>>>>>>>>>>>>>>>>>>>>[>>]<<->[<<<[<
<]<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>[>>]>-]<<<[<<]<<
<<<<<<<<<[-]<<<<<<<]<<[>>+<<-]>>[-<<+>>]<]

Extras
If you want to test the algorithm, you can use the following driver code. The code expects r1 to be the input number and leaves the output in r2, assuming r2 is already cleared:
movr1,666
@f
divr1,5
addr2,r1
jnzr1,%f
outr1

The resulting value might be outputted as an ASCII character, so you might have to use bfi fac.b | xxd to see the numerical value.
Optimizing for brainfuck source code size
We can optimize the code a fair bit. Since brainfuck has no notion of procedures, we can assume that @f is a while loop label (instead of being both a function and a normal label) and that we don't have to return.
The jnz instruction and the accompanying label can be replaced with a sequence of nav r1 / raw .[ or .]. To top it off, we use the -t flag for bfmake. The result:
>>>[>>>>+++++[>>>>+<<<<-]<<<<[>>>>>>>+>-[>>]<[[>+<-]<+>>>]<<<<<<<<<-]>>>>>>[<<<<<<+>>>>>>-]>[<<<+>>>-]>[<<<<+>>>>-]<<<<[-]<<<<[>+<<+>-]<[>+<-]>]

... at 144 bytes.

Excel, 25 bytes
=SUM(INT(A9/5^ROW(1:99)))

Calculates the number of 5s in the prime factorization.  In theory, it would work for all of the examples above, except Excel can't handle numbers as long as the last one with the correct precision.

Perl, 24 22 + 1 (-p flag) = 23 bytes
$\+=$_=$_/5|0while$_}{

Using:
> echo 2016 | perl -pe '$\+=$_=$_/5|0while$_}{'

Full program:
while (<>) {
# code above added by -p
    while ($_) {
        $\ += $_ = int($_ / 5);
    }
} {
# code below added by -p
    print;  # prints $_ (undef here) and $\
}

Pyke, 5 bytes
SBP5/

Try it here!
S     -    range(1,input()+1)
 B    -   product(^)
  P   -  prime_factors(^)
   5/ - count(^, 5)

Haskell, 39 bytes
Can't compete with @xnor, but it was fun and the result is a different approach:
f n=sum$[1..n]>>= \i->1<$[5^i,2*5^i..n]

RETURN, 17 bytes
[$[5÷\%$F+][]?]=F

Try it here.
Recursive operator lambda. Usage:
[$[5÷\%$F+][]?]=F666F

Explanation
[             ]=F  Lambda -> Operator F
 $                 Check if top of stack is truthy
  [       ][]?     Conditional
   5÷\%$F+         If so, do x/5+F(x/5)

Python 3, 52 bytes
g=lambda x,y=1,z=0:z-x if y>x else g(x,y*5,z+x//y)

J, 28 17 16 bytes
<.@+/@(%5^>:@i.)

Pretty much the same as the non-recursive technique from xnor's answer.

Here's an older version I have kept here because I personally like it more, clocking in at 28 bytes:
+/@>@{:@(0<;._1@,'0'&=@":@!)

Whilst not needed, I have included x: in the test cases for extended precision.
   tf0 =: +/@>@{:@(0<;._1@,'0'&=@":@!@x:)
   tf0 5
1
   tf0 100
24

   tf0g =: tf0"0
   tf0g 1 5 100 666 2016
0 1 24 165 502

The last number  doesn't work with this function.
Explanation
This works by calculating n!, converting it to a string, and checking each member for equality with '0'. For n = 15, this process would be:
15
15! => 1307674368000
": 1307674368000 => '1307674368000'
'0' = '1307674368000' => 0 0 1 0 0 0 0 0 0 0 1 1 1

Now, we use ;._1 to split the list on its first element (zero), boxing each split result, yielding a box filled with aces (a:) or runs of 1s, like so:
┌┬─┬┬┬┬┬┬┬─────┐
││1│││││││1 1 1│
└┴─┴┴┴┴┴┴┴─────┘

We simple obtain the last member ({:), unbox it (>), and perform a summation over it +/, yielding the number of zeroes.
Here is the more readable version:
split =: <;._1@,
tostr =: ":
is =: =
last =: {:
unbox =: >
sum =: +/
precision =: x:
n =: 15

NB. the function itself
tf0 =: sum unbox last 0 split '0' is tostr ! precision n
tf0 =: sum @ unbox @ last @ (0 split '0'&is @ tostr @ ! @ precision)
tf0 =: +/ @ > @ {: @ (0 <;._1@, '0'&= @ ": @ ! )

>:@i. can be written 1+i. to save a byte.

Your older version can be made into [:#.~'0'=":@! for 13 bytes by changing the method of counting the trailing 1s.

Jolf, 13 bytes
Ώmf?H+γ/H5ΏγH

Defines a recursive function which is called on the input. Try it here!
Ώmf?H+γ/H5ΏγH  Ώ(H) = floor(H ? (γ = H/5) + Ώ(γ) : H)
Ώ              Ώ(H) =
       /H5                           H/5
      γ                         (γ =    )
     +    Ώγ                              + Ώ(γ)
   ?H       H               H ?                  : H
 mf                   floor(                        )
               // called implicitly with input

Dyalog APL, 9 bytes
⊥⍨'0'=⍕!⎕

⎕ prompt for number
! factorialize
⍕ stringify
'0'= check equality to character zero
⊥⍨ count trailing trues*

*Literally it is a mixed-base to base-10 conversion, using the boolean list as both number and base:
⊥⍨0 1 0 1 1 is the same as 0 1 0 1 1⊥⍨0 1 0 1 1 which is  0×(0×1×0×1×1) 1×(1×0×1×1) 0×(0×1×1) 1×(1×1) + 1×(1) which again is two (the number of trailing 1s).

It's difficult to get myself in the headspace of APL. I'm just so used to low level imperative languages.  This was my attempt {+/⌊⍵÷5*⍳⌊5⍟⍵}. Also, I feel like there should be a way to make a train out of this, but I just can't see it.

@1_am_Jack The consecutive monadic functions are problematic: +/∘⌊⊢÷5*∘⍳∘⌊5⍟⊢ or +/⌊⍤÷5*5⍳⍤⌊⍤⍟⊢ or some hybrid of those ― Some resources here: apl.wiki/Tacit_programming#Tutorials

I like how APL is executed from right to left.

@TheEmptyStringPhotographer Right, but do you notice that it reads nicely from left to right? ⊥⍨ count the trailing '0' zeros = in ⍕ the string representation of ! the factorial of ⎕ the input.

Ruby, 70 61 51 49 bytes
Version 3 with thanks to Kenny Lau and daniero
->n{(n-n.to_s(5).chars.map(&:to_i).reduce(:+))/4}

Edit: Turns out you can save two bytes by mapping to_i before you reduce. Weird :P
This function subtracts the sum of n's base 5 digits from n and then divides that result by 4. This is related to the sum of the geometric series 1+5+25+..+5**n = (5**n+1)/4.
As an example (again, with thanks to Kenny Lau), consider 358 (2413 in base 5) minus its base 5 digits.
2413-2-4-1-3
= (2000-2) + (400-4) + (10-1) + (3-3)
# consider that 1000-1=444 and you'll see why every 5**n is multiplied by 4
= 2*444 + 4*44 + 1*4 + 3*0
= 2*(4*5**0+4*5**1+4*5**2) + 4*(4*5**0+4*5**1) + 1*(4*5**0) + 3*()
= 348

Divide 348 by 4 and you get f(358) = 87.
Version 2 with thanks to Kenny Lau
->n{s=(1..n).reduce(:*).to_s;s.size-s.reverse.to_i.to_s.size}

This function calculates n! then subtracts the size of n! from the size of (n!).reverse.to_i.to_s, which removes all the zeroes, thus, returning the size of the zeroes themselves.
Version 1
->n{s=n.to_s(5).chars;(0...s.size).reduce{|a,b|a+(s[0,b]*'').to_i(5)}}

This a variation of the "How many 5s are there in the prime factorization of n!?" trick that uses Ruby's simple base conversion builtins.
The golfing is a bit of a pain though, with converting from Integer to String to Array, grabbing part of the Array and converting that to String to Integer again for the reduce. Any golfing suggestions are welcome.

It's slightly shorter to map to_i before reducing: ->n{(n-n.to_s(5).chars.map(&:to_i).reduce(:+))/4} (saves two bytes)

@daniero I would not have expected that. Thanks :D

Java, 38 bytes
int z(int n){return n>0?n/5+z(n/5):0;}

Full program, with ungolfed method:
import java.util.Scanner;

public class Q79762{
    int zero_ungolfed(int number){
        if(number == 0){
            return 0;
        }
        return number/5 + zero_ungolfed(number/5);
    }
    int z(int n){return n>0?n/5+z(n/5):0;}
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.close();
        System.out.println(new Q79762().zero_ungolfed(n));
        System.out.println(new Q79762().z(n));
    }
}

J, 7 bytes
Monadic function, taking argument on the right.
3{:@q:!

If x is positive, x q: y returns the exponents in a prime factorization of y, for only the first x primes. The 3-rd prime is 5 and {: takes the tail of a list.
Note that you have to input integers with an x at the end, or else J will treat them as floats.
   3{:@q:! 100x
24
   3{:@q:! 666x
165
   3{:@q:! 2016x
502

Try it yourself at tryj.tk, though be warned that this online interpreter will complain if you try anything larger than 1343.
If you want something that doesn't compute n! and hence doesn't require it fit in an integer, use the recursive solution <.@%&5(+$:@)^:*. (tryj.tk is still whiny on large inputs.)

Pyt, 5 bytes
5←!ḋɔ

Explanation:
5             Pushes 5
 ←            Gets input
  !           Factorial
   ḋ          Prime factors (with duplicates)
    ɔ         Count occurrences of 5 in the list of prime factors

Try it online!

J, 15 bytes
+/<.(%5:^>:@i.)

Who needs to calculate factorial?
Probably longer than with though :p
Explanation when I get home

(%5:^>:@i.) -> (%5^1+i.)

Are you home yet?  We're still waiting for the promised explanation.

@TobySpeight I think he died.

Runic Enchantments, 21 bytes
Rl1)?@+
/:>i5,'fA:0)?

Try it online!
Uses the same f(n) = n/5 + f(n/5) as other answers. Just took some coercion to to reduce the footprint as much as possible. Fortunately > does nothing when executed (it simply marks the entry point) and i pushes nothing to the stack when no more input remains.

Python 2, 33 bytes
f=lambda n:n/5+f(n/5)if n>0else 0

Try it online!

Wow, I had no idea Python could parse out the >0 like that.

@Calculuswhiz It's pretty cool, although I think it no longer works in Python 3.

05AB1E, 4 bytes
!Ò5¢

Try it online!
!Ò5¢  # full program
   ¢  # number of...
  5   # literal...
   ¢  # s in...
 Ò    # prime factorization of...
!     # factorial of...
      # implicit input
      # implicit output

Thunno 2, 4 bytes
wf5c

Attempt This Online!
Explanation
wf5c  # Implicit input  ->  10
w     # Factorial       ->  3628800
 f    # Prime factors   ->  [2,2,2,2,2,2,2,2,3,3,3,3,5,5,7]
  5c  # Count 5s        ->  2
      # Implicit output

dc, 26
?[5/dd0<m]dsmx[+z1<m]dsmxp

rs, 95 bytes
(\d+)/(_)^^(\1)
_(_+)/_\1 \1
+_(_+) _(_+)$/(_\1)^^((^^_\2)) \2
 _$/
(_+)/(^^\1)
.*?(0*)$/(^^\1)

Live demo.
Note that I can't test this with large inputs such as 100. Feel free to try it, but you'd need over 8.486e145 TB of RAM...
An explanation of the first 5 lines is available here.  The last line just counts the zeroes at the end.

CJam, 11
Efficient solution, similar to other answers.
Loop version:
ri{5/_}h]:+

Try it online
Explanation:
ri      read the input and convert to integer
{…}h    do…while
  5/    divide by 5
  _     duplicate the last number
         the loop terminates when the number reaches 0
]:+     add all the numbers from the stack

Recursive version:
ri0{5/_j+}j

Try it online
Explanation:
ri       read the input and convert to integer
0{…}j    calculate with memoized recursion and initial value 0 for input 0
  5/     divide by 5
  _      duplicate the result
  j      calculate the number of zeros recursively for that number
  +      add the 2 results

PHP, 62 bytes
for($n=$z=0;++$n<=log(125,5);){$z+=floor(125/(5**$n));}echo$z;

exploded view
for ($n=$z=0; ++$n<=log(125,5); ) {
  $z += floor( 125 / (5 ** $n) );
}
echo $z;

The starting point for many of the answers here is that every 5th factor adds a single 0, since there are 2-3 even numbers that precede it, and you can only get a new 0 with both a factor of 2 and a factor of 5.
If we assumed this to be true, the answer is simple in PHP, in 23 bytes:
echo(floor(argv[0]/5));

However, consider 25!.  24! has 4 0's in it (because of 5, 10, 15, and 20).  But 25 adds two 5's to the equation, meaning 25! has 6 0's in it.  So we have to account for 5^n as well.

CJam, 9 bytes
l~m!mf5e=

Try it online!
Just counting the 5's 5e= in the prime factorization mf of the factorial m! of the input l~.
Doesn't work for big factorials, since they don't fit into an integer.

C, 53 bytes
 i,r;z(n){for(;i=n--;)for(;i=i%5?0:i/5;)r++;return r;}

Counting 5s in the sequence that makes up the factorial, instead of calculating the factorial and then counting its 5s.
Full program:
i,r;z(n){for(;i=n--;)for(;i=i%5?0:i/5;)r++;return r;}
#include <stdio.h>
int main(int argc, char **argv) {
    int n;
    sscanf(argv[1], "%d", &n);
    printf("%d -> %d\n", n, z(n));
    return 0;
}

Convex, 6 bytes
¡mf5e=

Use Java interpreter or this alternate version that works on TIO: Try it online
This would be 4 bytes if I was finished getting rid of 2 char operators....

PowerShell v2+, 60 bytes (but see the NB below)
A completely different approach, doing exactly what is requested by the challenge. ;-)
$a=2..$args[0]-join'*'|iex;"$a".length-"$a".Trim('0').length

Takes input $args and creates a dynamic range .., then -joins it together with * for multiplication, pipes that to iex (similar to eval) to compute the factorial. Store that in $a.
We then take the length of the string representation and subtract off the length of the string representation after we've passed it to .Trim('0') which will remove leading and trailing zeroes. Since there will never be leading zeroes, this gets us the result we want.
NB: The above will work for up to n=17 without a problem, as even though 17! is bigger than [Int]::MaxValue, since we didn't explicitly specify the casting for $a, PowerShell will dynamically convert it to [double] for us upon overflow. Yeah ... in PowerShell, [int] will overflow to [double] if not explicitly cast. No, I don't know why it goes to that rather than [int64].
However, at 18!, PowerShell will automatically convert the number to scientific notation when the implicit .ToString() is called (i.e., when encapsulating it within quotes), in order to preserve significant digits. We can get around that with explicit formatting instead -- $a="{0:0}"-f(2..$args[0]-join'*'|iex);$a.length-$a.Trim('0').length -- at 67 bytes. That will get us up to 20! before we start to run into loss of precision.
Thus, to handle an "arbitrary" input, we'll need to combine the above explicit formatting with the [bigint] datatype ...
PowerShell v2+, 80 bytes
$a="{0:0}"-f("[bigint]"+(2..$args[0]-join'*')|iex);$a.length-$a.Trim('0').length

This will prepend an explicit cast of [bigint] to the first number in the range 2, and in PowerShell the datatype on the left of the operator is used for output, so that [bigint] datatype will continue through the rest of the factorial calculation.

An few examples of the three methods at some key points, with some additional output text showing what's happening in the background -- the first output is the top code, the middle is with the explicit string formatting, and the bottom is with the [bigint] datatype.
PS C:\Tools\Scripts> .\golfing\zeroes-at-end-of-factorial.ps1 17
(Normal) 355687428096000 = 3
(Format) 355687428096000 = 3
(BigInt) 355687428096000 = 3

PS C:\Tools\Scripts> .\golfing\zeroes-at-end-of-factorial.ps1 18
(Normal) 6.402373705728E+15 = 0
(Format) 6402373705728000 = 3
(BigInt) 6402373705728000 = 3

PS C:\Tools\Scripts> .\golfing\zeroes-at-end-of-factorial.ps1 21
(Normal) 5.10909421717094E+19 = 0
(Format) 51090942171709400000 = 5
(BigInt) 51090942171709440000 = 4

PS C:\Tools\Scripts> .\golfing\zeroes-at-end-of-factorial.ps1 100
(Normal) 9.33262154439441E+157 = 0
(Format) 933262154439441000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000 = 143
(BigInt) 933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000
00000000 = 24

PS C:\Tools\Scripts> .\golfing\zeroes-at-end-of-factorial.ps1 666
(Normal) Infinity = 0
(Format) Infinity = 0
(BigInt) 101063205684078149339082270812987645175758239832414541134042080735741380210369702298920280680149101204098980220355752703933970405713072930283454242384
016585642874066153029797241068282869939717688434251350949378748077490349338925526287834176188326189942648494465716169313138031111761957305152642332038964180541
081606760789306748325981681536460982866866274811038560365797328460484207809414155642770874534510059882948847250594907196772727091196506088520929434066550648022
642608335790150309778114083249701373807911277761571911620331754219999948922714475266708579675248268885046126373228453917614236582397369676453760327876932228670
885547506983568164371084614056976933006577541441308350104365957229945444651724282400214055514046429629100190143841467573055296491456926973403850076414055114364
283612861330473414734808609512385966092678846067118146921625221337465049955783174195059482714722569989641408869425126104519667256749553222882671938160611697400
311264211156133257350321296072971178199390387741639438171846476552757501425212904028323696392262434445697502405816736843180906854457725847298397943781807264821
360865009874936976105696120379126536366566469680224519996204004154443821032721047698220334845859609307929656956126740947391412413210205581149373619966878853487
232170536051130524871079644147921335454258357607659625021345466796883799602327316306909470042946710666392541958119313633986054565867362395523193239940480940410
876723200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000 = 165

GNU coreutils, 34 bytes
seq $1|factor|tr \  \\n|grep -cx 5

The set of prime factors of the factorial n! is the union of the sets of prime factors of 1..n.  We just need to count the number of fives, as this will always be less than the number of twos, and it takes one five and one two to produce each trailing zero.  Happily, n==0 correctly produces 0, even though the question doesn't require that.
The output of factor is not quite what we want (in fact, in every golf I do, the reprinting of input is a nuisance):
$ seq 6|factor
1:
2: 2
3: 3
4: 2 2
5: 5
6: 2 3

By replacing each space with a newline, we can match lines that are exactly 5 (this handily eliminates the 5: prefix for that line), and count the total.
You will probably run out of memory and/or time trying the last of the example inputs, but there's nothing in the program itself that wouldn't work.

bc, 51 bytes
define f(x){if(x){return x/5+f(x/5)}else{return 0}}

Same tactic as in xnor and Cᴏɴᴏʀ O'Bʀɪᴇɴ's answers, but longer.

Erlang, 33 bytes
f(0)->0;f(N)->N div 5+f(N div 5).

Same tactic as in xnor and Cᴏɴᴏʀ O'Bʀɪᴇɴ's answers.
Ungolfed:
f(0) -> 0;
f(N) when N > 0 -> N div 5 + f(N div 5).

GML, 35 bytes
a=argument0 while a/=5b+=a return b

Japt, 6 bytes
Can only handle inputs up to 21 due to JavaScript's integer limitations.
Êk xv5

Try it

Explanation
Ê          :Factorial
 k         :Prime factors
   v5      :Divisible by 5?
  x        :Reduce by addition

PHP, 43 39 bytes
based on Toby Speight´s C solution
function f($n){return$n?f($n/=5)+$n|0:0;}

Try it online.

Stax, 4 bytes
╩+Pî

Run and debug it
I omitted the final test case.  The algorithm is correct, but the time requirements are beyond my patience or predicted lifespan.
Method:

Compute factorial
Calculate "multiplicity" by 10.

Forth (gforth), 38 bytes
Based on Toby Speight's C Solution
: f dup 0> if 5 / dup recurse + then ;

Try it online!
Code Explanation
: f           \ start a new word definition
  dup 0> if   \ check if n > 0
    5 / dup   \ divide by 5 and duplicate if so
    recurse   \ call f on n/5
    +         \ add to sum
  then        \ end if
;             \ end word definition

Keg, -rR, 9 bytes
0&¡÷{0=|⑹

Try it online!
I'm sure there is a more efficient way by using some sort of formula, but a counting method was the best I could think of.
Explained
0&¡÷{0=|⑹
0&          #Store 0 in the register
  ¡÷        #Take the factorial of the (implicit) input and item split
    {0=     #While the top item is still 0:
       |⑹  #    Increment the register
            #-rR prints the register as an integer at end of execution

naz, 10 bytes
1r3s5d9s1o

Try it online!
The maximum factorial that naz could technically store is \$5!\$ (120), so being allowed to assume that \$n!\$ will fit within our language's integer type paves the way for a very boring answer.
We first read \$n\$ from the input string, which sets the register to \$n\$'s ASCII value \$k\$. The number of zeroes at the end of \$n!\$ is then given by:
$$\lfloor(k - 3) / 5\rfloor - 9$$
The only value of \$k\$ that will result in a value of \$1\$ is \$53\$, which corresponds to \$n = 5\$.

Lua, 48 bytes
function u(x)return x>0 and x//5+u(x//5)or 0 end

Try it online!

AWK, 34 bytes
{i=$0;for($0=0;i;)$0+=i=int(i/5)}1

Ungolfed:
{i=$0;for($0=0;i;)$0+=i=int(i/5)}1
{                               }   for each line
 i=$0;                                save it in i
          $0=0;                       set output to 0
      for(     i;)                    while i is nonzero
                        int(i/5)        divide i by 5 without reminder
                      i=                save the result in i
                  $0+=                  and add it to output
                                 1    print output

Try it online!

Risky, 6 bytes
!!?+_0__/\\?

Try it online!
Explanation
! length
!       factorial
?         input
+     +
_
0         0
_   apply function
_
/         5
\     find indices in
\       prime factors
?         argument


text:
What is the most frequent word?
What is the most frequent word?
Given a sentence, your program must make its way through it, counting the frequencies of each word, then output the most used word. Because a sentence has no fixed length, and so can get very long, your code must be as short as possible.
Rules/Requirements

Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.
There must be a free interpreter/compiler available for your language.
If it is possible, provide a link to a site where your program can be tested.
Your program must not write anything to STDERR.
Your program should take input from STDIN (or the closest alternative in your language).
Standard loopholes are forbidden.
Your program must be case-insensitive (tHe, The and the all contribute to the count of the).
If there is no most frequent word (see test case #3), your program should output nothing.

Definition of a 'word':
You get the list of words by splitting the input text on spaces. The input will never contain any other type of whitespace than plain spaces (in particular no newlines). However, the final words should only contain alphanumerics (a-z, A-Z, 0-9), hyphens (-) and apostrophes ('). You can make that so by removing all other characters or by replacing them by space before doing the word splitting. To remain compatible with previous versions of the rules, apostrophes are not required to be included.
Test Cases
The man walked down the road.
==> the

-----

Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.
==> he

-----

This sentence has no most frequent word.
==>

-----

"That's... that's... that is just terrible!" he said.
==> that's / thats

-----

The old-fashioned man ate an old-fashioned cake.
==> old-fashioned

-----

IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.
==> IPv6

-----

This sentence with words has at most two equal most frequent words.
==>

Note: The third and seventh test cases have no output, you may choose either on the fourth.
Scoring
Programs are scored according to bytes. The usual character set is UTF-8, if you are using another please specify.
When the challenge finishes, the program with the least bytes (it's called code-golf), will win.
Submissions
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

Leaderboard
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 79576; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 53406; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Comments are not for extended discussion; this conversation has been moved to chat.

So given your new definition of 'word', what is the most common word here don't d'ont dont a a? Would it be dont?

@DrGreenEggsandHamDJ If you have a submission that does remove apostrophes, dont. If not, a. but most submissions do, and so dont is a correct answer.

Is the output case-sensitive? So is ipv6 valid output for the last test case?

@kirbyfan64sos Case in the output is irrelevant.

An extra test case may be of use: "This sentence with words has at most two equal most frequent words." -->

Just to clarify: if I'm writing a function, I can't take the input as a parameter? It must be from the stdin?

@Carcigenicate Nah, I think that's just a mistake in the wording.

Pyke, 26 25 bytes
l1dcD}jm/D3Sei/1qIi@j@
(;

Try it here!
Or 23 22 bytes (noncompeting, add node where kills stack if false)
l1cD}jm/D3Sei/1q.Ii@j@

Try it here!
Or with punctuation, 23 bytes (I think this competes? Commit was before the edit)
l1.cD}jm/D3Sei/1q.Ii@j@

Try it here!
Or 12 bytes (definitely noncompeting)
l1.cj.#jR/)e

Try it here!
l1           -     input.lower()
  .c         -    punc_split(^)
    j        -   j = ^
     .#   )  -  sort(V(i) for i in ^)
       jR/   -   j.count(i)
           e - ^[-1]

Your 23 byte answer would compete if the only punctuation preserved was - and ' (hyphen and apostrophe).

It only preserves punctuation that isn't at the end of a word

Oh, OK (I don't understand Pyke). I guess it competes then...

@GeorgeGibson I'm pretty sure the 23 byte version doesn't compete - it could come under standard loopholes. Also I don't expect (m)any people to understand Pyke, I'm making it as my own language

Alright then. I think you still win anyway, so it doesn't really matter.

Oh yeah, I posted earlier than the Jelly answer

I'm getting errors for all of the ones except for the 12 byte version, I presume this was an update to the interpreter?

@Okx almost certainly. There's been about 60 commits since I last edited this so I wouldn't be surprised if at least one of them was breaking

Jelly, 25 bytes
ṣ⁶f€ØB;”-¤Œl©Qµ®ċÐ€ĠṪịµẋE

Try it online! or verify all test cases.

Pyth - 23 30 bytes
There has to be a better way to include digits and hyphens, but I just want to fix this right now.
Kc@s+++GUTd\-rzZ)I!tJ.M/KZ{KhJ

Test Suite.

The revised rules require preserving digits and hyphens.

@GeorgeGibson fixed.

Octave, 115 94 bytes
[a,b,c]=unique(regexp(lower(input('')),'[A-z]*','match'));[~,~,d]=mode(c); try disp(a{d{:}})

Accounts for the case with no most frequent word by using try. In this case it outputs nothing, and "takes a break" until you catch the exception.
Saved 21(!) bytes thanks to Luis Mendo's suggestion (using the third output from mode to get the most common word).

The rules have changed quite a bit since I posted my original answer. I'll look into the regex later.

you beat me to it, gonna think for something else now.

Apply mode on c maybe? Its third output gives all tied values, if I recall correctly

I count 115 bytes.

I believe your regex should be ['\w\d] because you have to preserve apostrophes and digits. Unless those are between upper and lower case in ASCII, in which case ignore me because I don't have a table handy.

@StewieGriffin [~, ~, out] = mode([1 1 2 2 1 2 3 4 5 5]) gives out = {1 2}

Ah, misunderstood you the last time. Thanks Luis! Saved a lot of bytes! =)

doesnt try have to be enclosed by an end ? and about mode function doesnt it return the smallest most common number ?

Perl 6, 80 bytes
{$_>1&&.[0].value==.[1].value??""!!.[0].key given .lc.words.Bag.sort:{-.value}}

Let's split the answer into two parts...
given .lc.words.Bag.sort:{-.value}

given is a control statement (like if or for). In Perl 6, they're allowed as postfixes. (a if 1, or like here, foo given 3). given puts its topic (right-hand side) into the special variable $_ for its left-hand side.
The "topic" itself lowercases (lc), splits by word (words), puts the values into a Bag (set with number of occurences), then sorts by value (DESC). Since sort only knows how to operate on lists, the Bag is transformed into a List of Pairs here.
$_>1&&.[0].value==.[1].value??""!!.[0].key

a simple conditional (?? !! are used in Perl 6, instead of ? :).
$_ > 1

Just checks that the list has more than one element.
.[0].value==.[1].value

Accesses to $_ can be shortened... By not specifying the variable. .a is exactly like $_.a. So this is effectively "do both top elements have the same number of occurences" – If so, then we print '' (the empty string).
Otherwise, we print the top element's key (the count): .[0].key.

It's like half English, half line-noise. Amazing.

it's funny how it's the OO-style features that look english-y :P

Also manages to be less readable than Perl 5 while containing more English than Perl 5. D:

@cat fixed it -- should be totally unreadable now

value??!! (i know that's a ternary operator, it's just entertaining)

Ruby, 94 92 102 bytes
Gotta go fast (FGITW answer). Returns the word in all uppercase, or nil if there is no most frequent word.
Now updated to new specs, I think. However, I did manage to golf down a little so the byte count is the same!
->s{w=s.upcase.tr("_'",'').scan /[-\w]+/;q=->x{w.count x};(w-[d=w.max_by(&q)]).all?{|e|q[e]<q[d]}?d:p}

Gotta go fast?

@cat yeah, 'cuz I was FGITW this time

05AB1E, 30 bytes
Code:
lžj¨„ -«Ãð¡©Ùv®yQOˆ}®¯MQÏDg1Q×

Uses CP-1252 encoding. Try it online!.

hmm?

@TessellatingHeckler It only takes one line of input. Unless you repeatedly use the I command, 05AB1E will only take as much as it needs.

JavaScript (ES6), 155 bytes
s=>(m=new Map,s.toLowerCase().replace(/[^- 0-9A-Z]/gi,'').split(/\ +/).map(w=>m.set(w,-~m.get(w))),[[a,b],[c,d]]=[...m].sort(([a,b],[c,d])=>d-b),b==d?'':a)

Based on @Blue's Python answer.

Your regex replace looks like it drops numbers, and will break the IPv6 test case, is that right?

@TessellatingHeckler The definition of word changed since I originally read the question, but I've updated my answer now.

Python 3.5, 142 137 134 112 117 110 127 bytes:
(+17 bytes, because apparently even if there are words more frequent than the rest, but they have the same frequency, nothing should still be returned.)
def g(u):import re;q=re.findall(r"\b['\-\w]+\b",u.lower());Q=q.count;D=[*map(Q,{*q})];return['',max(q,key=Q)][1in map(D.count,D)]

Should now satisfy all conditions. This submission assumes that at least 1 word is input.
Try It Online! (Ideone)
Also, if you want one, here is another version of my function devoid of any regular expressions at the cost of about 43 bytes, though this one is non-competitive anyways, so it does not really matter. I just put it here for the heck of it:
def g(u):import re;q=''.join([i for i in u.lower()if i in[*map(chr,range(97,123)),*"'- "]]).split();Q=q.count;D=[*map(Q,{*q})];return['',max(q,key=Q)][1in map(D.count,D)]

Try this New Version Online! (Ideone)

From the challenge comments "if there are two words that are more frequent than the rest, but with the same frequency", the output is 'nothing'.

@RootTwo Fixed! :)

@TessellatingHeckler Those are different words though. That's is a contraction for that is whereas thats is not really a word.

@TessellatingHeckler Can you give me some proof of this comment? Because I am going through all the comments on the post and see no such comment.

Pyth, 32 bytes
p?tlJeM.MhZrS@Ls++\-GUTcrz0d8ksJ

Test suite.

Sqlserver 2008, 250 bytes
DECLARE @ varchar(max) = 'That''s... that''s... that is just terrible!" he said.';

WITH c as(SELECT
@ p,@ x
UNION ALL
SELECT LEFT(x,k-1),STUFF(x,1,k,'')FROM
c CROSS APPLY(SELECT patindex('%[^a-z''-]%',x+'!')k)k
WHERE''<x)SELECT max(p)FROM(SELECT top 1with ties p
FROM c WHERE p>''GROUP BY p
ORDER BY count(*)DESC
)j HAVING count(*)=1

Try it online!
Sqlserver 2016, 174 bytes
Unable to handle data like this example(counting the equals as 3 words):
DECLARE @ varchar(max) = 'That''s... that''s... that is just terrible!" he said. = = ='

SELECT max(v)FROM(SELECT TOP 1WITH TIES value v
FROM STRING_SPLIT(REPLACE(REPLACE(REPLACE(@,'"',''),',',''),'.',''),' ')GROUP
BY value ORDER BY count(*)DESC)x HAVING count(*)=1

I don't like variable approach because it is kind of cheating :) One input -> nothing or something, with set-based approach it has to be longer, because you need to add additional GROUP BY, LEFT JOIN, or PARTITION BY Anyway SQL Server has built in SPLIT function. Ungolfed demo feel free to make it as short as possible.

@lad2025 thanks alot, didn't know any features from 2016. SPLIT_STRING surely is a long overdue feature. I tried to golf the script down using split, got it down to 174, however it will not be able to filter out text like "= = ="

PostgreSQL, 246, 245 bytes
WITH z AS(SELECT DISTINCT*,COUNT(*)OVER(PARTITION BY t,m)c FROM i,regexp_split_to_table(translate(lower(t),'.,"''',''),E'\\s+')m)
SELECT t,CASE WHEN COUNT(*)>1 THEN '' ELSE MAX(m)END
FROM z WHERE(t,c)IN(SELECT t,MAX(c)FROM z GROUP BY t)
GROUP BY t

Output:

Input if anyone is interested:
CREATE TABLE i(t TEXT);

INSERT INTO i(t)
VALUES ('The man walked down the road.'), ('Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.'),
       ('This sentence has no most frequent word.'), ('"That''s... that''s... that is just terrible!" he said. '), ('The old-fashioned man ate an old-fashioned cake.'),
       ('IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.'), ('a   a            a b b b c');

Normally I would use MODE() WITHIN GROUP(...) and it will be much shorter, but it will violate:

If there is no most frequent word (see test case #3), your program should output nothing.

EDIT:
Handling ':
WITH z AS(SELECT DISTINCT*,COUNT(*)OVER(PARTITION BY t,m)c FROM i,regexp_split_to_table(translate(lower(t),'.,"!',''),E'\\s+')m)
SELECT t,CASE WHEN COUNT(*)>1 THEN '' ELSE MAX(m)END
FROM z WHERE(t,c)IN(SELECT t,MAX(c)FROM z GROUP BY t)
GROUP BY t

SqlFiddleDemo
Output:
╔═══════════════════════════════════════════════════════════════════════════════════════════════╦═══════════════╗
║                                              t                                                ║      max      ║
╠═══════════════════════════════════════════════════════════════════════════════════════════════╬═══════════════╣
║ a a a b b b c                                                                                ║               ║
║ The old-fashioned man ate an old-fashioned cake.                                              ║ old-fashioned ║
║ IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.  ║ ipv6          ║
║ This sentence has no most frequent word.                                                      ║               ║
║ "That's... that's... that is just terrible!" he said.                                         ║ that's        ║
║ The man walked down the road.                                                                 ║ the           ║
║ Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.        ║ he            ║
╚═══════════════════════════════════════════════════════════════════════════════════════════════╩═══════════════╝

could not get as low as you, sqlserver doesn't have build in split yet. However the select part is shorter.

@GeorgeGibson Sure, fixed + added live demo.

@lad2025 By common agreement in chat, what you did is no longer necessary, feel free to revert back.

@GeorgeGibson Yup, edit will be much clear. Live demo is working now, when I wrote answer sqlfiddle was not responding.

JavaScript (ES6), 99 bytes

F=s=>(f={},w=c='',s.toLowerCase().replace(/[\w-']+/g,m=>(f[m]=o=++f[m]||1)-c?o>c?(w=m,c=o):0:w=''),w)
#input { width: 100%; }
<textarea id="input" oninput="output.innerHTML=F(this.value)"></textarea>

Retina, 97 bytes
The rules keep changing...
T`L`l
[^-\w ]

O`[-\w]+
([-\w]+)( \1\b)*
$#2;$1
O#`[-\w;]+
.*\b(\d+);[-\w]+ \1;[-\w]+$

!`[-\w]+$

Try it online!
Test suite.

Fails for this input.

@CᴏɴᴏʀO'Bʀɪᴇɴ Thanks, fixed.

And you golfed it 11 bytes ._. impressive

Also fails for "The old-fashioned man ate an old-fashioned cake."

This doesn't look right either (expecting a to be the most common word there)

@TessellatingHeckler I don't accept newline as separator

Python, 132 bytes
import collections as C,re
def g(s):(a,i),(b,j)=C.Counter(re.sub('[^\w\s-]','',s.lower()).split()).most_common(2);return[a,''][i==j]

Above code assumes that input has at least two words.

Got to love that regex, tho.

This is incorrect. The character class \w includes underscores.

R, 115 bytes
function(s)if(sum(z<-(y=table(tolower((x=strsplit(s,"[^\\w']",,T)[[1]])[x>""])))==max(y))<2)names(which(z))else NULL

This is a function that accepts a string and returns a string if a single word appears more often than others and NULL otherwise. To call it, assign it to a variable.
Ungolfed:
f <- function(s) {
    # Create a vector of words by splitting the input on characters other
    # than word characters and apostrophes
    v <- (x <- strsplit(s, "[^\\w']", perl = TRUE))[x > ""]

    # Count the occurrences of each lowercased word
    y <- table(tolower(v))

    # Create a logical vector such that elements of `y` which occur most
    # often are `TRUE` and the rest are fase
    z <- y == max(y)

    # If a single word occurs most often, return it, otherwise `NULL`
    if (sum(z) < 2) {
        names(which(z))
    } else {
        NULL
    }
}

Python 2, 218 bytes
Assumes more than 2 words. Getting rid of punctuation destroyed me...
import string as z
def m(s):a=[w.lower()for w in s.translate(z.maketrans('',''),z.punctuation).split()];a=sorted({w:a.count(w)for w in set(a)}.items(),key=lambda b:b[1],reverse=1);return a[0][0]if a[0][1]>a[1][1]else''

Does this strip ',- etc?

@Tim No, I did this challenge before the rules were fully fleshed. Will change.

Can you assign the result of sorted to a tuple rather than having to index into the array manually?

@Neil you mean just get the first and second items for comparison instead of the entire array? I don't know how to do that

Matlab (225)

Rules chaneged :/

.
      function c=f(a),t=@(x)feval(@(y)y(y>32),num2str(lower(x)-0));f=@(x)num2str(nnz(x)+1);e=str2num(regexprep(a,'([\w''-]+)',' ${t($1)} ${f($`)} ${f([$`,$1])}'));[u,r,d]=mode(e);try c=find(e==d{:});c=a((e(c(1)+1)):(e(c(1)+2)));end

Toolbox is necessary to run this.
How does this work, one of the nicest privileges of regex replace in matlab this it field-executes tokens by calling external-environmental functions parameterized by the tokens caught in the inner environment, so any sequence of "Word_A Word_B .." is replaced by integers "A0 A1 A2 B0 B1 B2 ..." where the first integer is the numerica ascii signature of the word, the second is the starting index, the third is the ending index, these last two integers dont reduplicate in the whole sequence so i took this advantage to transpose it to an array, then  mode it then search the result in that array, so the starting/ending indices will consequently follow.
Edit: after changing some details, the program is called function by a string parameter.

20 bytes saved thanks to @StewieGriffin, 30 bytes added reproaches to common-agreed loopholes.

You'll have my upvote when you (or someone else) show that this actually works, both for inputs that have a most common word, and for inputs that don't. =) (I can't test it, unfortunately)

@StewieGriffin i think the programe misbehaves with sentences with equi-frequence words i will fix that

PHP, 223 bytes
$a=array_count_values(array_map(function($s){return preg_replace('/[^A-Za-z0-9]/','',$s);},explode(' ',strtolower($argv[1]))));arsort($a);$c=count($a);$k=array_keys($a);echo($c>0?($c==1?$k[0]:($a[$k[0]]!=$a[$k[1]]?$k[0]:'')):'');

Perl, 60 56 55 54 bytes
Includes +3 for -p
#!/usr/bin/perl -p
s/[\pL\d'-]+/$;[$a{lc$&}++]++or$\=$&/eg}{$\x=2>pop@

If a word cannot be just a number you can also drop the a for a score of 53.

Does the hyphen in the -anE not count? It does on the other answer (+2 bytes for -p flag)...

@GeorgeGibson No, see http://meta.codegolf.stackexchange.com/questions/273/on-interactive-answers-and-other-special-conditions. The hyphen, the space and the E do not count. The other answer would normally only have to do +1 bytes for -p, but his solution has ' so it cannot be seen as an extension of -e or -E. So he should in fact count +3 (not +2) since he should count the space and the hyphen (but every extra option would only be +1).

@TomHospel Oh, right.

Is this considered valid given the apostrophe rule? [\pL\d-] looks like it could be shrunken down to [\w-] (unless we care about underscores) but either version will report that instead of that's or thats for test 4. Otherwise, you need to add 4 bytes to insert \x27 in that character class (unless you have a better way of adding an apostrophe).

@AdamKatz The definition of 'word' changed quite a bit while this was running and I never fully adopted the last version. But to keep you happy I created a fixed (and shorter) version :-). And yes, I do care about underscores

Shell, 89 86 82 bytes
grep -Po "[\w'-]+"|sort -f|uniq -ci|sort -nr|awk 'c>$1{print w}c{exit}{c=$1;w=$2}'

This lists all words in the input, then sorts them with counts from most common to least common.  The awk call merely ensures that the #2 word doesn't have the same count as the #1 word.
Unwrapped:
grep -Po "[\w'-]+"      # get a list of the words, one per line
  |sort -f              # sort (case insensitive, "folded")
  |uniq -ci             # count unique entries while still ignoring case
  |sort -nr             # sort counted data in descending order
  |awk '
    count > $1 {        # if count of most common word exceeds that of this line
      print word        # print the word saved from it
    }
    count {             # if we have already saved a count (-> we are on line 2)
      exit              # we always exit on line 2 since we have enough info
    }
    {                   # if true (run on line 1 only due to the above exit)
      count = $1        # save the count of the word on this first line
      word = $2         # save the word itself
    }'

grep -o is the magic tokenizer here. It takes each word (as defined by a regex accepting word characters (letters, numbers, underscore), apostrophe, or hyphen using PCRE given -P) and puts it on its own line.  This accepts underscores, as to many other answers here.  To disallow underscores, add four characters to turn this portion into grep -oi "[a-z0-9'-]*"
alias cnt='sort -f |uniq -ci |sort -nr' is an old standby of mine. Without regards to case, it alphabetizes (erm, asciibetizes) the lines of the input counts occurrences of each entry, then reverse-sorts by the numeric occurrences so the most popular is first.
awk only looks at the first two lines of that descending ranked list. On line one, count is not yet defined, so it is evaluated as zero and therefore the first two stanzas are skipped (zero == false).  The third stanza sets count and word.  On the second line, awk has a defined and nonzero value for count, so it compares that count to the second best count. If it's not tied, the saved word is printed. Regardless, the next stanza exits for us.
Test implemented as:
for s in "The man walked down the road." "Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy." "This sentence has no most frequent word." "\"That's... that's... that is just terrible\!\" he said." "The old-fashioned man ate an old-fashioned cake." "IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses." "This sentence with words has at most two equal most frequent words."; do printf "%s\n==> " "$s"; echo "$s" |grep -io "[a-z0-9'-]*"|sort -f|uniq -ci|sort -nr|awk 'c>$1{print w}c{exit}{c=$1;w=$2}'; echo; done

05AB1E, 22 21 20 bytes
žK„- JÃl#{D.MDgiJëõ?

Explanation:
žK                     # Push [a-zA-Z0-9]
  „-                   # Push 2-char string containing a hyphen and a space
     J                 # Join the stack into a single element
      Ã                # Removes all characters from implicit input except those specified above
       l               # Converts to lowercase
        #              # Split string by spaces
         {             # Sorts array
          D            # Duplicates
           .M          # Finds most common element
             Dg        # Gets length of string without popping
                 iJ    # If length == 1, then convert the array to a string (otherwise the output would be ['example'] instead of example
                   ëõ? # Else push an empty string.

Note: If you're fine with trailing newlines in the output for when you're not supposed to output anything, remove the ? at the end to save a byte.
Note #2: The program will not work with a single word, but I doubt this would be a problem. If you want to fix this, replace # with ð¡ for an extra byte.
05AB1E uses CP-1252 as the charset, not UTF-8.
Try it online!

Julia 1.0, 140 133 bytes
~s=(d=Dict();split(replace(lowercase(s),r"[^\' 0-9a-z-]"=>"")).|>w->d[w]=get(d,w,0)+1;(x,y)=findmax(d);sum(x.==values(d))<2 ? y : "")

Try it online!
-7 bytes thanks to MarcMush: replace count(i->d[i]==x,keys(d)) with sum(x.==values(d))

-7 bytes: sum(x.==values(d)) instead of count(...)

There is maybe other recent solutions of yours where sum can be used instead of count

Python, 158 bytes
def g(s):import collections as c,re;l=c.Counter(re.sub('[^\w\s-]',"",s.lower()).split());w,f=l.most_common(1)[0];return[w,""][all(f==i[1]for i in l.items())]

Takes its input like this:
g("Bird is the word")

Should match all the requirements, although it does fail on empty strings, is it necessary to check for those? Sorry for the delay.
Advice / feedback / black magic tips for saving bytes are always welcome

Hi, and welcome to PPCG! We score [tag:code-golf] challenges by the number of bytes in the answer. I went ahead and edited it for you with the correct information.

Welcome to PPCG! Unfortunately, your submission does not satisfy all the requirements of this challenge as, first of all, it's NOT case insensitive. For instance, it will NOT count occurrences of the word That as occurrences of the word that since the former begins with an uppercase T and the latter begins with a lowercase t. Also, this does NOT remove all other forms of punctuation except hyphens (-) and, optionally, apostrophes (') and as a result, this would NOT work for the fourth test case given in the question.

Also, this does NOT output nothing if there is no most frequent word. For instance, using the third test case (This sentence has no most frequent word.) as an example, your function outputs [('This', 1)], when it should instead be outputting nothing. I could go on and on about more issues, so I would recommend fixing them as soon as you can.

Will do soon, when I have time

This is incorrect. The character class \w includes underscores.

Lua, 232 199 175 bytes
w,m,o={},0;io.read():lower():gsub("[^-%w%s]",""):gsub("[%w-]+",function(x)w[x]=(w[x]or 0)+1 end)for k,v in pairs(w)do if m==v then o=''end if(v>m)then m,o=v,k end end print(o)

if not w[x]then w[x]=0 end w[x]=w[x]+1 end -> w[x]=(w[x]or0)+1

if m==v then o=''end -> o=m==v and '' or o

bash, 153 146 131 154 149 137 bytes
declare -iA F
f(){ (((T=++F[$1])==M))&&I=;((T>M))&&M=$T&&I=$1;}
read L
L=${L,,}
L=${L//[^- a-z0-9]}
printf -vA "f %s;" $L
eval $A;echo $I

Operation:
declare an associative array F of integers (declare -iA F)
f is a function that, given a word parameter $1, increments frequency count for this word (T=++F[$1]) and compares to max count so far (M).
If equal, the we have a tie so we will not consider this word to be most frequent (I=)
If greater than max count so far (M), then set max count so far to frequency count of this word so far (M=$T) and remember this word (I=$1)
End function f
Read a line (read L)
Make lowercase (L=${L,,})
Remove any character except a-z, 0-9, dash(-) and space (L=${L//[^- a-z0-9]})
Make a sequence of bash statements that calls f for each word (printf -vA "f %s;" $L). This is saved to variable A.
eval A and print result (eval $a;echo$I)
Output:
This quick brown fox jumps over this lazy dog.
-->this
This sentence with the words has at most two equal most frequent the words.
-->
The man walked down the road.
-->the
This sentence has no most frequent word.
-->
Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.
-->he
"That's... that's... that is just terrible!" he said.
-->thats
The old-fashioned man ate an old-fashioned cake.
-->old-fashioned
IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.
-->ipv6

Bug: FIXED
I have a bug that is not revealed in these test cases.
If input is
This sentence with words has at most two equal most frequent words.

then my code should output nothing.
I have a fix but I seem to have hit a bash bug... I get very odd behaviour is M is not declared an integer: ++F[$1]==M (after a few repeated words) increments both F[$1] and M!! - my mistake.

Rexx, 109 128 122 bytes
pull s;g.=0;m=0;do i=1 to words(s);w=word(s,i);g.w=g.w+1;if g.w>=m then do;m=g.w;g.m=g.m+1;r=w;end;end;if g.m=1 then say r

Pretty printed...
pull s
g.=0
m=0
do i=1 to words(s)
  w=word(s,i)
  g.w=g.w+1
  if g.w>=m
  then do
    m=g.w
    g.m=g.m+1
    r=w
  end
end
if g.m=1 then say r

I don't think this handles all cases of tied most frequent words - see (new) last test case - I made similar mistake.

Hopefully, that's fixed it now

PowerShell (v4), 117 bytes
$y,$z=@($input-replace'[^a-z0-9 \n-]'-split'\s'|group|sort Count)[-2,-1]
($y,($z,'')[$y.Count-eq$z.Count])[!!$z].Name

The first part is easy enough:

$input is ~= stdin
Regex replace irrelevant characters with nothing, keep newlines so we don't mash two words from the end of a line and the beginning of the next line into one by mistake. (Nobody else has discussed multiple lines, could golf -2 if the input is always a single line).
Regex split, Group by frequency (~= Python's collections.Counter), Sort to put most frequent words at the end.
PowerShell is case insensitive by default for everything.

Handling if there isn't a most frequent word:

Take the last two items [-2,-1] into $y and $z;
an N-item list, where N>=2,  makes  $y and $z the last two items
a 1-item list makes $y the last item and $z null
an Empty list makes them both null

Use the bool-as-array-index fake-ternary-operator golf (0,1)[truthyvalue], nested, to choose "", $z or $y as output, then take .Name.
PS D:\> "The man walked down the road."|.\test.ps1
The

PS D:\> "Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy."|.\test.ps1
he

PS D:\> "`"That's... that's... that is just terrible!`" he said."|.\test.ps1
Thats

PS D:\> "The old-fashioned man ate an old-fashioned cake."|.\test.ps1
old-fashioned

PS D:\> "IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses."|.\test.ps1
IPv6

Perl 5, 96 92 84 + 2 (-p flag) = 86 bytes
++$h{+lc}for/\w(?:\S*\w)?/g}{$m>$e[1]||$e[1]>$m&&(($_,$m)=@e)||($_="")while@e=each%h

Using:
> echo "The man walked down the road." | perl -p script.pl

Your -p flag should invoke a penalty of 3 bytes. The rules are roughly: Each commandline flag is +1 byte since that is how many extra bytes you need to extend your free -e'code' style commandline. So normally -p is only +1 byte. But here your code has ' so it cannot be run simply from the commandline without escaping. So no combining with -e and the - and the space before the p are extra and must be counted too

@TonHospel Fixed.

This is actually 84 + 1 (-p flag) if you invoke it on the command line as perl -pe'…' (made available by removing the ' as noted in the first comments)

Tcl 8.6, 196 bytes
lmap s [join [read stdin] \ ] {dict incr d [regsub -all {[^\w-]} [string tol $s] {}]}
set y [dict fi $d v [lindex [lsort [dict v $d]] end]]
if {[llength $y]!=2} {set y {}}
puts "==> [lindex $y 0]"

(Alas, I can't figure out how to get it any smaller than that...)
Explanation
It uses several obscure Tcl idioms to do stuff.

[join [read stdin] " "]
— input string→list of whitespace-separated words
lmap ...
— iterate over every element of that list. (Shorter than foreach and effectually identical since the result is discarded.)
[regsub ... [string tolower ...]]
— Convert the string to lowercase and strip all characters except for word characters and the hyphen.
[dict incr d ...]
— Create/modify a dictionary/word→count histogram.
set y ...
— Sort the dictionary values, take the largest one, and return all (key,value) pairs corresponding to it.
if...
— There must be exactly two elements: a single (key,value) pair, else there is nothing to print.
puts...
— Print the key in the key value pair, if any. (No word has spaces.)

You can play with it using CodeChef.

182

Python 3, 106 bytes
def f(s):s=s.split();z=sorted([s.count(i)for i in set(s)]);return("",max(set(s),key=s.count))[z[-2]<z[-1]]

You can use s.split()

split method by default uses spaces, so you can save 3 bytes by changing s.split(" ") to s.split()

Java 7, 291 bytes
import java.util.*;Object c(String s){List w=Arrays.asList(s.toLowerCase().split("[^\\w'-]+"));Object r=w;int p=0,x=0;for(Object a:w){p=Collections.frequency(w,r);if(Collections.frequency(w,a)>p)r=a;if(p>x)x=p;}for(Object b:w)if(!b.equals(r)&Collections.frequency(w,b)==p)return"";return r;}

The rule where it should output nothing when there are multiple words with the same occurrence took quite a bit of extra code..
Ungolfed:
import java.util.*;
Object c(String s){
  List w = Arrays.asList(s.toLowerCase().split("[^\\w'-]+"));
  Object r = w;
  int p = 0,
      x = 0;
  for(Object a : w){
    p = Collections.frequency(w, r);
    if(Collections.frequency(w, a) > p){
      r = a;
    }
    if(p > x){
      x = p;
    }
  }
  for(Object b : w){
    if(!b.equals(r) & Collections.frequency(w, b) == p){
      return "";
    }
  }
  return r;
}

Test code:
Try it here.
import java.util.*;
class M{
  static Object c(String s){List w=Arrays.asList(s.toLowerCase().split("[^\\w'-]+"));Object r=w;int p=0,x=0;for(Object a:w){p=Collections.frequency(w,r);if(Collections.frequency(w,a)>p)r=a;if(p>x)x=p;}for(Object b:w)if(!b.equals(r)&Collections.frequency(w,b)==p)return"";return r;}

  public static void main(String[] a){
    System.out.println(c("The man walked down the road."));
    System.out.println(c("Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy."));
    System.out.println(c("This sentence has no most frequent word."));
    System.out.println(c("\"That's... that's... that is just terrible!\" he said."));
    System.out.println(c("The old-fashioned man ate an old-fashioned cake."));
    System.out
        .println(c("IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses."));
    System.out.println(c("This sentence with words has at most two equal most frequent words."));
  }
}

Output:
the
he
     (nothing)
that's
old-fashioned
ipv6
     (nothing)

Python 3, 76 98 100 bytes
import re,statistics as S
try:print(S.mode(re.split("([a-z0-9-]+)",input().lower())[1::2]))
except:1

Try it online
Outputs the most common word as lowercase. Does not include apostrophes because "apostrophes are not required to be included."
statistics.mode requires Python 3.4
Unfortunately, no output to stderr is allowed, or it'd be much shorter.

You're not allowed to print to STDERR, unless this program doesn't produce any error output?

Your new program doesn't support hyphens! I tried the input i- test i-

Fixed it all. Still short.

R, 96 bytes
19 bytes shorter than the existing R answer, with a somewhat different approach.
t=table(gsub("[^a-z0-9'-]","",tolower(scan(,''))))
`if`(sum(t==max(t))-1,'',names(which.max(t)))

Reads from stdin, so the input is automatically separated by spaces. We convert to lowercase and use gsub to remove all non-alphanumerics (plus - and '). We count the instances of each word with table and save the result to t. Next, we check if there is more than 1 maximum in t (by seeing if there is more than one element which is equal to max(t). If so, we return the empty string ''. If not, we return the word corresponding to the maximum in t.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Implement Amb and Require
The Challenge
Implement amb and its sister statement require in whatever language you wish. See http://community.schemewiki.org/?amb for an example implementation in Scheme. You can rename them to a and r.
amb statements select a value passed to it arbitrarily, and require statements written after amb contain conditionals that limit the possibilities that amb will return, as the conditionals must evaluate to true. statements The pseudocode
fun rand() {
    return amb(1, 2, 3, 4)
}

will return whatever the computer feels like as long as it is 1, 2, 3 or 4. However the pseudocode
fun arbitary2 {
    x = amb(1, 2, 3, 4)
    y = square(x)
    require(even(y))
    return x
}

can only ever eventually return 2 or 4, but a user may not know which one will return. Depending on implementation, 2 may always be returned, or 4, or 2 is returned 3% of the time and so on. require can be called any time after amb is called as long as both statements are in the same program, even outside of the scope of amb, so
fun foo() {
    amb(1,2,3,4)
}
x = foo()
y = foo()
require(x > y)

is valid and x will never be less than y when the program successfully terminates. The degree to which this is possible varies language by language, so try your best to implement this. The following code should not successfully terminate:
amb(1, 2, 3, read("notes.txt"))
require(false)
print("this will never be printed")

The actual names and exact syntax of amb and require don't matter. For example, if your implementation is in assembly, then having amb read from predefined registers is legitimate as long as the essence of amb is preserved, and require can checked whether a certain register contains a certain value.
Try your best and have fun!
Scoring
This has been changed from popcon to code-golf, so make your implementations short! Least number of characters wins. Don't cheat and rename existing implementations. Any submission which does something to the effect of:
#define r rename
#define a amb

will be disqualified.

require is an existing keyword in several languages, for example javascript and ruby. Can we call it something different to avoid clashes? If so, how will this affect the byte count?

@LevelRiverSt As far as I can tell, the byte count does not count.

@KennyLau yeah I assumed it was a codegolf; I saw that later. It's started attracting close votes for being "opinion based". U.Butterfly, welcome to PPCG. We require an objective winning criterion, and codegolf would be more objective than popcon. It's up to you of course, but I see no reason why this couldn't be a codegolf; it would need a tighter spec to ensure fairness though. You are welcome to use our sandbox in future: http://meta.codegolf.stackexchange.com/q/2140/15599

@LevelRiverSt The actual names and syntax doesn't matter as long as you implement functionality. Feel free to call it r and a. As for popcon vs codegolf, I don't see the point in having the popcon tag exist if ya'll want numeric (byte) criteria. And this is certainly more objective than the coloring popcon, which was, in the end, not put on hold. Just delete the popcon tag if you don't want it. I chose popcon because I felt it would be more fun for all participants and spectators to encourage zany implementations. I suppose I'll change it to codegolf since that is what this site wants.

Note that ideally require can be called any time after amb is called as long as both statements are in the same program, even outside of the scope of amb, so Ideally is not so good. Most people will not do it, unless it is required.

are you sure with respect to your counterexample as the boolean expression does not depend on the amb-value and the amb-value is never used further? Something like x = amb(...); require(x == false); return x; would make more sense to me.

@Alex Your code is selecting a value of x that equals false. The example code will never ever successfully complete since require can never ever be true. It's just to highlight that when require can never be satisfied, i.e. requiring an odd number when only even numbers are applied to amb, the program shouldn't execute after that point. I'll edit the post to make it more clear.

Mathematica, 143 bytes
a={{}};b=e@Length@Last[a=Join@@Outer[Append,a,#,1]]&;c@z_:=a=Select[a,#~f~z&];d@z_:=RandomChoice[#~f~z&/@a];f=#2/.Thread[e/@Range@Length@#->#]&

This code defines three functions. b (amb) and c (require) do what you expect, with amb taking a List of values and require taking an expression. d converts an amb expression to a human-readable value. As an upside, amb expressions act exactly like their values, with the final result being lazily evaluated during the d call. Gets slow when more than 3 amb expressions are entered. Could probably be golfed further.

Scala, 406/377 Bytes
I offer two golfed versions of my implementation, one that chooses the value randomly and one that (somehow) abuses the task description and always returns the first legal value. It's up to you, with one to consider (the latter one is shorter, obviously):
trait A[X]{def g=scala.util.Random.shuffle(l).head;def l:Seq[X];def -(d:X)};class M{def a[X](e:Seq[X])=new A[X]{var s=e;def l=s;def -(d:X)=s=s.filter(_!=d)};def r(v:A[Boolean])=v-false;def p[X,Y](a:A[X],b:A[Y])=new A[(X,Y)]{var x=List[Any]();def l=(for(e<-a.l;f<-b.l)yield(e,f)).diff(x);def -(d:(X,Y))=x::=d};def o[X,Y](v:A[X],f:X=>Y)=new A[Y]{def l=v.l.map(f);def -(d:Y)=v.l.filter(f(_)==d).foreach(v.-)}}
trait A[X]{def g=l(0);def l:Seq[X];def -(d:X)};class M{def a[X](e:Seq[X])=new A[X]{var s=e;def l=s;def -(d:X)=s=s.filter(_!=d)};def r(v:A[Boolean])=v-false;def p[X,Y](a:A[X],b:A[Y])=new A[(X,Y)]{var x=List[Any]();def l=(for(e<-a.l;f<-b.l)yield(e,f)).diff(x);def -(d:(X,Y))=x::=d};def o[X,Y](v:A[X],f:X=>Y)=new A[Y]{def l=v.l.map(f);def -(d:Y)=v.l.filter(f(_)==d).foreach(v.-)}}

This versions are more or less just golfed versions of my initial submission (some implementations have changed slightly, but the interfaces were quite stable). Therefore I will not explain it any further but refer to my initial post. Just have in mind that everything that was "for convenience" now disappeared. And a lot of renaming happened. The only difference is that pairs are now a bit like new amb-values: If you define conditions on top of pairs this will never effect the underlying values (nevertheless, manipulating the underlying values will still affect the pairs).
To give you a hint on how to use this versions, here is a short testing code I used while golfing:
  val m = new M
  val a1 = m.a(List(1, 2, 3, 4, 5))
  val a2 = m.a(List(4, 5, 6))
  val a12 = m.p(a1, a2)
  m.r(m.o(a12, (p:(Int, Int)) => p._1 > p._2))
  m.r(m.o(a1, (e: Int) => e%2==1))

  println(a1.l)
  println(a2.l)
  println(a12.l)
  println(a12.g)

As you can see, the offered functions are now instance-methods, hence, you need an instance of M to interact with my library (this saved me one glorious byte).
Note that my ungolfed version (which I will not update any more) now includes natural syntax for the most common Int- and Boolean-operations.

(my initial submission)
Right before posting this answer the Mathematica answer was stated and it looks as if my solution is based on similar assumptions. Nevertheless, I will offer my solution, too, because I didn't copied the former answer as it wasn't there when I started.
I didn't tried to recreate a natural syntax (like: (amb(1, 2, 3) + 3) * 5, etc), but this would be possible if you like to implement the necessary implicit conversions. I chose the functional way as you will see later.
Let's start with the two keywords:
import ambiguous.AmbOps.op

object Amb {
  def amb[A](args: A*): AmbType[A] =
        new BasicAmb[A](args.toList)
  def require(amb: AmbType[Boolean]): Unit =
        amb.del(false)
  def require[A](amb: AmbType[A], predicate: A => Boolean): Unit =
        require(op(amb, predicate))
  def require[A, B](amb: AmbType[(A, B)], predicate: (A, B) => Boolean): Unit =
        require(op(amb, predicate))
}

The amb-method is quite straight forward, you provide some values and get some container, that may return a value back (more on that later).
I offer three require methods but they are all based on the first one, so the others are just for convenience. Let me explain the first one (the others will become clear as you read on): If you have some boolean amb-Container and call require, all false values are eliminated.
But how is an amb-value of arbitrary type converted into a boolean value? By offering a conversion-policy:
object AmbOps {
  def op[A, B](amb: AmbType[A], op: A => B): AmbType[B] =
        new OpAmb[B, A](amb, op)
  def op[A, B, C](amb: AmbType[(A, B)], op: (A, B) => C): AmbType[C] =
        new OpAmb[C, (A, B)](amb, p => op(p._1, p._2))
  def pair[A, B](ambA: AmbType[A], ambB: AmbType[B]): AmbType[(A, B)] =
        new AmbPair[A, B](ambA, ambB)
}

Assume we have some numerical amb-value and want to square each element, then just call op with a corresponding function: op(amb(1, 2, 4), (e: Int) => e * e) // returns a value equivalent to amb(1, 4, 16) Following the same scheme you can convert the elements to boolean values for example with op(amb(1, 2, 4), (e: Int) => e%2 == 0)
If you have several amb-values and you want to define conditions between them, it isn't that easy to do with my approach when only using amb, require and op. Therefore I defined the method pair. With pair you can create tuples/pairs out of two amb-values (or any number if you again pair pairs with other values or pairs). If you then define conditions on top of this tuples, the illegal pairs will be eliminated. But the original values aren't always manipulated. Only if this process leads to the situation that one element from one of the initial amb-values is no longer legal in any tuple, than this value is completely eliminated from the initial amb-value. If now some other amb-value (or pair) is based on this manipulated amb-value, the dependent value will also miss the deleted element.
That means that if you need a pair of values fulfilling a condition, you have to get an element from the pair-value and you cannot always rely on the original values, but I think this is a acceptable limitation.
Just for convenience there is an additional op-method for tuples.
Now we have to dig deeper into the technical details of the amb-containers:
import scala.util.Random

trait AmbType[A] {
  def get: A = {
    if (list.isEmpty)
      throw new IllegalStateException("no value left")
    else list(Random.nextInt(list.length))}
  private[ambiguous] def list: List[A]
  private[ambiguous] def del(a: A): Unit
}

class BasicAmb[A](private var args: List[A]) extends AmbType[A] {
  override private[ambiguous] def list: List[A] = args
  override private[ambiguous] def del(a: A): Unit = { args = args.filterNot(_ == a)}
}

class OpAmb[A, B](amb: AmbType[B], op: B => A) extends AmbType[A] {
  override private[ambiguous] def list: List[A] = amb.list.map(op)
  override private[ambiguous] def del(a: A): Unit = amb.list.filter(op(_) == a).foreach(amb.del)
}

class AmbPair[A, B](ambA: AmbType[A], ambB: AmbType[B]) extends AmbType[(A, B)] {
  private var deleted: List[(A, B)] = List()
  override private[ambiguous] def list: List[(A, B)] =
    ambA.list.flatMap(a => ambB.list.map(b => (a, b))).diff(deleted)
  override private[ambiguous] def del(a: (A, B)): Unit = {
    deleted ::= a
    ambA.list.filter(a => !list.exists(_._1 == a)).foreach(a => {ambA.del(a); deleted = deleted.filterNot(_._1 == a)})
    ambB.list.filter(b => !list.exists(_._2 == b)).foreach(b => {ambB.del(b); deleted = deleted.filterNot(_._2 == b)})
  }
}

I don't want to say too much about the classes but one thing is worth mentioning: If you create pairs of two amb-values and define some conditions on top of them and afterwards define some further conditions on top of one of the original values, the pair-class misses to check if an element of the not-changed original value may be deleted as it doesn't appear as part of one pair any more. So some further observer-pattern would be great.
Now let's take a look on how to use this:
// create amb-values by invoking amb
val a = amb(1, 2, 3, 4)

// do some maths on a value
val b = op(a, (e: Int) => e + 2)

// define some conditions
require(b, (e: Int) => e%3 == 0)
// or first apply the condition to the value and afterwards pass the value to require
val filtered = op(b, (e: Int) => e%3 == 0)
require(filtered)

// pair values
val paired = pair(a, amb("hello", "welcome"))
// note that the amb-value a now only contains the elements 1 and 4 as the former requirement eliminated the other two

// state a condition on pairs
require(paired, (a: Int, b: String) => b.length % a == 0)
// now the amb-value a only contains the element 1 as there was no string with length divisible by 4

// query a value from our pairs (by calling get)
val selected = paired.get
// at this point only two pairs are left, so selected will always be either (1, "hello") or (1, "welcome")
val number = selected._1
val greetings = selected._2

Nice first answer!

thanks, @EᴀsᴛᴇʀʟʏIʀᴋ!! I visited PPCG for quite a while now but just as an observer. This was the first question that motivated me to actually participate in the challenges. And the fact that there were no answers when I started to program was some sort of extra motivation (sadly someone was faster than me).

Yeah, it was the same with me. :D  And don't worry, the FGITW (fastest gun in the west) effect happens to everybody.

The one which returns the first value is perfectly sufficient. The example implementation always returns the first successful value.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/